pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch( dialogid )
{
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Making your account ..","You have entered an invalid password.\nType your password below to register a new account.","Register","Quit");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"PlayerData");
new HashPass[129];
WP_Hash(HashPass, sizeof(HashPass), inputtext);
INI_WriteString(File, "Password", HashPass);
INI_WriteInt(File,"Cash",0);
INI_WriteInt(File,"Admin",-1);
INI_WriteInt(File,"Kills",0);
INI_WriteInt(File,"Deaths",0);
INI_WriteInt(File,"Muted",0);
INI_WriteInt(File,"VIP",0);
INI_WriteInt(File,"Skin",0);
INI_Close(File);
SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,"Account created!","You've created an account successfuly. Relogging is recommended, although you don't have too.","Ok","");
}
}
case DIALOG_LOGIN:
{
if ( !response ) return Kick ( playerid );
if( response )
{
new HashPass[129];
WP_Hash(HashPass, sizeof(HashPass), inputtext);
if(strcmp(HashPass, PlayerInfo[playerid][pPass]) == 0)
{
INI_ParseFile(UserPath(playerid), "LoadUser_data", .bExtra = true, .extra = playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
//ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,"Success!","You have successfully logged in!","Ok","");
ShowPlayerDialog(playerid, DIALOG_SPAWN, DIALOG_STYLE_LIST,"Choose your team","Terrorist\nPolice","Spawn","");
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"Login","You have entered an incorrect password.\nType your password below to login.","Login","Quit");
}
return 1;
}
}
case DIALOG_RULES:
{
if(!response)
{
SendClientMessage(playerid, COLOR_RED, "|- Error: Agree to the rules or you'll be banned next time");
Kick(playerid);
printf("player %s disagreed to the rules.", Name(playerid));
return 1;
}
}
case DIALOG_SHOP:
{
if(!response)
{
return 0;
}
else
{
switch(listitem)
{
case 0:
{
if(PlayerInfo[playerid][pCash] == 700)
{
ServerWeapon(playerid, 22, 300);
// ShowPlayerDialog(playerid, DIALOG_SHOP, DIALOG_STYLE_LIST, "Shop", "Colt 45($700)\nDesert Eagle($1,00)\nShotgun ($2,00)\nCombat Shotgun($3,500)\nMP5($1,500)\nAk-47($2,500)\nM4($3,500)", "Buy", "Cancel");
PlayerInfo[playerid][pCash] -= 700;
}
else SendClientMessage(playerid, COLOR_RED, "|- Error: You don't have enough cash to purchase this!");
}
case 1:
{
if(PlayerInfo[playerid][pCash] == 1000)
{
ServerWeapon(playerid, 24, 100);
//ShowPlayerDialog(playerid, DIALOG_SHOP, DIALOG_STYLE_LIST, "Shop", "Colt 45($700)\nDesert Eagle($1,00)\nShotgun ($2,00)\nCombat Shotgun($3,500)\nMP5($1,500)\nAk-47($2,500)\nM4($3,500)", "Buy", "Cancel");
PlayerInfo[playerid][pCash] -= 1000;
}
else SendClientMessage(playerid, COLOR_RED, "|- Error: You don't have enough cash to purchase this!");
}
case 2:
{
if(PlayerInfo[playerid][pCash] == 2000)
{
ServerWeapon(playerid, 25, 50);
//ShowPlayerDialog(playerid, DIALOG_SHOP, DIALOG_STYLE_LIST, "Shop", "Colt 45($700)\nDesert Eagle($1,00)\nShotgun ($2,00)\nCombat Shotgun($3,500)\nMP5($1,500)\nAk-47($2,500)\nM4($3,500)", "Buy", "Cancel");
PlayerInfo[playerid][pCash] -= 2000;
}
else SendClientMessage(playerid, COLOR_RED, "|- Error: You don't have enough cash to purchase this!");
}
}
}
}
if(dialogid == DIALOG_SPAWN) // 441
{
switch(listitem)
{
case 0:
{
SetSpawnInfo( playerid, 1, 124, 413.5646,2537.1045,19.1484,175.2024, 0, 0, 0, 0, 0, 0 );
SpawnPlayer(playerid);
SetPlayerPos(playerid, 413.5646,2537.1045,19.1484);
SetPlayerInterior(playerid, 0);
Terro[playerid] = 1;
TogglePlayerSpectating(playerid, 0);
SendClientMessage(playerid, COLOR_RED, "General Khan: Kill all the police that get in your way! GO GO GO!");
SetPlayerColor(playerid, COLOR_RED);
return 1;
}
case 1:
{
SetSpawnInfo( playerid, 2, 287, 218.1994,1856.7305,13.0597,1.0574, 0, 0, 0, 0, 0, 0 );
SpawnPlayer(playerid);
SetPlayerPos(playerid, 218.1994,1856.7305,13.0597);
SetPlayerInterior(playerid, 0);
Police[playerid] = 1;
TogglePlayerSpectating(playerid, 0);
SendClientMessage(playerid, 0x8FD8D8, "Constable Greene: Eliminate all Talibans in the area! GO GO GO!");
SetPlayerColor(playerid, COLOR_CYAN);
return 1;
}
}
return 1;
}
}
return 1;
}