08.04.2012, 14:52
Hey again!
I'm really bad at spacing between two different commands!
Could you help me with the spacing?
I've highlighted the spot!
I'm really bad at spacing between two different commands!
Could you help me with the spacing?
I've highlighted the spot!
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == SHOP_DIALOG)//If the dialog responded to is our Weapon Shop dialog.
{
if(!response) return SendClientMessage(playerid, -1, "Apu voice: Thank you come again!");//If they click "Exit" they have left the dialog(Shop).
switch(listitem)
{
case 0://Country Rifle
{
if(GetPlayerMoney(playerid) >= 3000)//If they have more or equal to the price.
{
GivePlayerMoney(playerid, GetPlayerMoney(playerid) - 3000);//Take the cost.
GivePlayerWeapon(playerid, 33, 60);//Give them the weapon/ammo.
SendClientMessage(playerid, -1, "Country Rifle purchased.");//And let them know they just purchased a weapon.
return 1;//Tell pawno to stop processing now.
}
else//Else the dont have enough money to cover the purchase.
{
SendClientMessage(playerid, COLOR_RED, "You dont have 3000 dollars!");//Tell them.
return 1;//Tell pawno to stop processing now.
}
}
case 1://AK-47
{
if(GetPlayerMoney(playerid) >= 6000)//If they have more or equal to the price.
{
GivePlayerMoney(playerid, GetPlayerMoney(playerid) - 6000);//Take the cost.
GivePlayerWeapon(playerid, 30, 100);//Give them the weapon/ammo.
SendClientMessage(playerid, -1, "AK-47 purchased.");//And let them know they just purchased a weapon.
return 1;//Tell pawno to stop processing now.
}
else//Else the dont have enough money to cover the purchase.
{
SendClientMessage(playerid, COLOR_RED, "You dont have 6000 dollars!");//Tell them.
return 1;//Tell pawno to stop processing now.
}
}
case 2://M4
{
if(GetPlayerMoney(playerid) >= 6000)//If they have more or equal to the price.
{
GivePlayerMoney(playerid, GetPlayerMoney(playerid) - 6000);//Take the cost.
GivePlayerWeapon(playerid, 31, 100);//Give them the weapon/ammo.
SendClientMessage(playerid, -1, "M4 purchased.");//And let them know they just purchased a weapon.
return 1;//Tell pawno to stop processing now.
}
else//Else the dont have enough money to cover the purchase.
{
SendClientMessage(playerid, COLOR_RED, "You dont have 6000 dollars!");//Tell them.
return 1;//Tell pawno to stop processing now.
}
}
case 3://RPG
{
if(GetPlayerMoney(playerid) >= 10000)//If they have more or equal to the price.
{
GivePlayerMoney(playerid, GetPlayerMoney(playerid) - 10000);//Take the cost.
GivePlayerWeapon(playerid, 34, 100);//Give them the weapon/ammo.
SendClientMessage(playerid, -1, "RPG purchased.");//And let them know they just purchased a weapon.
return 1;//Tell pawno to stop processing now.
}
else//Else the dont have enough money to cover the purchase.
{
SendClientMessage(playerid, COLOR_RED, "You dont have 10 000 dollars!");//Tell them.
return 1;//Tell pawno to stop processing now.
}
// I HAVE A PROBLEM ENDING THE COMMAND BEFORE THE SWITCH, THEREFORE I GET BIG ERRORS!
switch( dialogid )
{
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteInt(File,"Cash",0);
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"Kills",0);
INI_WriteInt(File,"Deaths",0);
INI_Close(File);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Have fun Bitches!","Ok","");
}
}
case DIALOG_LOGIN:
{
if ( !response ) return Kick ( playerid );
if( response )
{
if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in!","Ok","");
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
}
return 1;
}
}
}
return 1;
}