add toy model preview
This commit is contained in:
parent
b755e6ffa1
commit
8c2dd222d2
@ -47,7 +47,7 @@
|
||||
#define DIALOG_GARAGE_INTERIORS 1035
|
||||
#define DIALOG_GARAGE_INT_CONFIRM 1036
|
||||
#define DIALOG_GANG_LIST 1037
|
||||
//#define DIALOG_LUMBERJACK 1038
|
||||
#define DIALOG_TOY_PREVIEW 1038
|
||||
#define DIALOG_FIGHTSTYLE 1039
|
||||
#define DIALOG_TOYS_MAIN 1040
|
||||
#define DIALOG_TOYS 1041
|
||||
|
@ -25,6 +25,8 @@
|
||||
#define CATEGORY_MISC ( 10 )
|
||||
#define CATEGORY_VIP ( 11 )
|
||||
|
||||
#define MODEL_PREVIEW_TOY ( 15 )
|
||||
|
||||
/* ** Variables ** */
|
||||
enum E_ATTACHED_DATA
|
||||
{
|
||||
@ -382,28 +384,55 @@ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
|
||||
{
|
||||
if ( x == listitem )
|
||||
{
|
||||
if ( p_ToyUnlocked[ playerid ] { g_ToyData[ id ] [ E_ID ] } )
|
||||
{
|
||||
showToyCategoryItems( playerid, p_ToyCategorySelected{ playerid }, .pawnshop = true );
|
||||
return SendError( playerid, "You have already bought this toy." );
|
||||
}
|
||||
|
||||
if ( GetPlayerCash( playerid ) < g_ToyData[ id ] [ E_PRICE ] )
|
||||
{
|
||||
showToyCategoryItems( playerid, p_ToyCategorySelected{ playerid }, .pawnshop = true );
|
||||
return SendError( playerid, "You cannot afford this toy." );
|
||||
}
|
||||
|
||||
UnlockPlayerToy( playerid, g_ToyData[ id ] [ E_ID ] );
|
||||
GivePlayerCash( playerid, -g_ToyData[ id ] [ E_PRICE ] );
|
||||
showToyCategoryItems( playerid, p_ToyCategorySelected{ playerid }, .pawnshop = true );
|
||||
SendServerMessage( playerid, "You have bought a "COL_GREY"%s"COL_WHITE" for "COL_GOLD"%s"COL_WHITE".", g_ToyData[ id ] [ E_NAME ], cash_format( g_ToyData[ id ] [ E_PRICE ] ) );
|
||||
SetPVarInt( playerid, "toy_item", id );
|
||||
ShowPlayerDialog( playerid, DIALOG_TOY_PREVIEW, DIALOG_STYLE_TABLIST, "{FFFFFF}Purchase Toys", sprintf( "Purchase Toy\t"COL_GOLD"%s\nPreview Toy\t ", cash_format( g_ToyData[ id ] [ E_PRICE ] ) ), "Select", "Back" );
|
||||
break;
|
||||
}
|
||||
x ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( dialogid == DIALOG_TOY_PREVIEW )
|
||||
{
|
||||
if ( ! response )
|
||||
return showToyCategoryItems( playerid, p_ToyCategorySelected{ playerid }, .pawnshop = true );
|
||||
|
||||
new
|
||||
id = GetPVarInt( playerid, "toy_item" );
|
||||
|
||||
if ( ! ( 0 <= id < sizeof( g_ToyData ) ) )
|
||||
return SendError( playerid, "An error has occurred, please try again." );
|
||||
|
||||
switch ( listitem )
|
||||
{
|
||||
// bought
|
||||
case 0:
|
||||
{
|
||||
if ( p_ToyUnlocked[ playerid ] { g_ToyData[ id ] [ E_ID ] } )
|
||||
{
|
||||
showToyCategoryItems( playerid, p_ToyCategorySelected{ playerid }, .pawnshop = true );
|
||||
return SendError( playerid, "You have already bought this toy." );
|
||||
}
|
||||
|
||||
if ( GetPlayerCash( playerid ) < g_ToyData[ id ] [ E_PRICE ] )
|
||||
{
|
||||
showToyCategoryItems( playerid, p_ToyCategorySelected{ playerid }, .pawnshop = true );
|
||||
return SendError( playerid, "You cannot afford this toy." );
|
||||
}
|
||||
|
||||
UnlockPlayerToy( playerid, g_ToyData[ id ] [ E_ID ] );
|
||||
GivePlayerCash( playerid, -g_ToyData[ id ] [ E_PRICE ] );
|
||||
showToyCategoryItems( playerid, p_ToyCategorySelected{ playerid }, .pawnshop = true );
|
||||
SendServerMessage( playerid, "You have bought a "COL_GREY"%s"COL_WHITE" for "COL_GOLD"%s"COL_WHITE".", g_ToyData[ id ] [ E_NAME ], cash_format( g_ToyData[ id ] [ E_PRICE ] ) );
|
||||
}
|
||||
|
||||
// preview
|
||||
case 1:
|
||||
{
|
||||
return ShowPlayerModelPreview( playerid, MODEL_PREVIEW_TOY, "Toy Preview", g_ToyData[ id ] [ E_MODEL ] );
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( dialogid == DIALOG_TOYS_BONE || dialogid == DIALOG_TOYS_BONE_EDIT )
|
||||
{
|
||||
new
|
||||
@ -569,6 +598,19 @@ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
|
||||
return 1;
|
||||
}
|
||||
|
||||
hook OnPlayerEndModelPreview( playerid, handleid )
|
||||
{
|
||||
if ( handleid == MODEL_PREVIEW_TOY )
|
||||
{
|
||||
new
|
||||
id = GetPVarInt( playerid, "toy_item" );
|
||||
|
||||
SendServerMessage( playerid, "You have finished looking at this toy preview." );
|
||||
return ShowPlayerDialog( playerid, DIALOG_TOY_PREVIEW, DIALOG_STYLE_TABLIST, "{FFFFFF}Purchase Toys", sprintf( "Purchase Toy\t"COL_GOLD"%s\nPreview Toy\t ", cash_format( g_ToyData[ id ] [ E_PRICE ] ) ), "Select", "Back" ), Y_HOOKS_BREAK_RETURN_1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* ** Commands ** */
|
||||
CMD:toys( playerid, params[ ] )
|
||||
{
|
||||
|
@ -6840,18 +6840,17 @@ CMD:job( playerid, params[ ] )
|
||||
|
||||
CMD:jaillist( playerid, params[ ] )
|
||||
{
|
||||
new count = 0;
|
||||
SendClientMessage( playerid, COLOR_GOLD, ".: Jail List :." );
|
||||
foreach(new i : Player)
|
||||
{
|
||||
if ( p_Jailed{ i } == true )
|
||||
{
|
||||
SendClientMessageFormatted( playerid, -1, "%s (%d seconds)", ReturnPlayerName( i ), p_JailTime[ i ] );
|
||||
count++;
|
||||
}
|
||||
}
|
||||
if ( count == 0 ) SendClientMessage( playerid, -1, "There are no players in jail." );
|
||||
return 1;
|
||||
szBigString[ 0 ] = '\0';
|
||||
|
||||
foreach( new i : Player ) if ( IsPlayerJailed( i ) ) {
|
||||
format( szBigString, sizeof( szBigString ), "%s%s%s(%d)\t%d seconds", szBigString, p_AdminJailed{ i } ? ( COL_RED ) : ( COL_WHITE ), ReturnPlayerName( i ), i, p_JailTime[ i ] );
|
||||
}
|
||||
|
||||
if ( szBigString[ 0 ] == '\0' ) {
|
||||
return SendError( playerid, "There are no players in jail." );
|
||||
} else {
|
||||
return ShowPlayerDialog( playerid, DIALOG_NULL, DIALOG_STYLE_TABLIST, ""COL_WHITE"Jail List", szBigString, "Close", "" );
|
||||
}
|
||||
}
|
||||
|
||||
CMD:lastlogged( playerid, params[ ] )
|
||||
|
Loading…
Reference in New Issue
Block a user