#if defined FILTERSCRIPT public OnFilterScriptInit() { print("Shop System"); return 1; } #endif public OnFilterScriptExit() { print("Shop System"); return 1; } public OnPlayerText(playerid, text[]) { return 1; } public OnPlayerCommandText(playerid, cmdtext[]) { if (strcmp("/shop", cmdtext, true, 10) == 0) { ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Shop Menu", "Deagle($250)\nAK-47($500)\nM4($500)\nGrenade($250)\nSniper($500)\nMP5($500)\nArmor($1000)", "Choose", "Exit"); return 1; } return 0; } public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if(dialogid == 1) // Menu Help Dialog { if(!response) return SendClientMessage(playerid, 0xFFFFFFAA, "Selection Canceled!"); switch(listitem) { case 0: // Deagle { GivePlayerWeapon(playerid, 24, 50); GivePlayerMoney(playerid, -250); return 1; } case 1: // AK-47 { GivePlayerWeapon(playerid, 30, 200); GivePlayerMoney(playerid, -500); return 1; } case 2: // M4 { GivePlayerWeapon(playerid, 31, 150); GivePlayerMoney(playerid, -500); return 1; } case 3: // Grenade { GivePlayerWeapon(playerid, 16, 2); GivePlayerMoney(playerid, -250); return 1; } case 4: // Sniper { GivePlayerWeapon(playerid, 34, 25); GivePlayerMoney(playerid, -500); return 1; } case 5: // MP5 { GivePlayerWeapon(playerid, 29, 200); GivePlayerMoney(playerid, -500); return 1; } case 6: // Armor { SetPlayerArmour(playerid, 100.0); GivePlayerMoney(playerid, -1000); return 1; } } } }
{ if (strcmp("/heal", cmdtext, true, 10) == 0) { if(GetPlayerMoney(playerid) >= -250) SetPlayerHealth(playerid, 100); GivePlayerMoney(playerid, -250); } else { SendClientMessage(playerid, -1, "You don't have enough money!"); } }
if( GetPlayerMoney( playerid ) < amount )
{
// player hasnt got enough cash
}
else
{
// player has enough cash
}
GetPlayerMoney( playerid ) < amount ? /* player hasnt got enough cash */ : /* has enough cash*/;
public OnPlayerCommandText(playerid, cmdtext[]) { if (strcmp("/heal", cmdtext, true, 10) == 0) { if( GetPlayerMoney( playerid ) < 250 ); // line 151 { SetPlayerHealth(playerid, 100); GivePlayerMoney(playerid, -250); } else // line 156 { SendClientMessage(playerid, 0xAA3333AA, "You don't have enough cash!"); } return 1; } }
public OnPlayerCommandText(playerid, cmdtext[]) { if (strcmp("/heal", cmdtext, true, 10) == 0) //the command { if(GetPlayerMoney(playerid) < 1000) return SendClientMessage(playerid, 0x9EC73DAA, "You don't have enough cash to Heal You Self"); //if player dosen't have enouth money GivePlayerMoney(playerid, -1000); SetPlayerHealth(playerid, 100); // health status SendClientMessage(playerid, 0x2641FEAA, "You have succesfully Healed Your Self"); //after healing } |
case 1: // AK-47 { GivePlayerWeapon(playerid, 30, 200); GivePlayerMoney(playerid, -500); return 1; }
case 1: /ak-47 { if(GetPlayerMoney(playerid) < 500) return SendClientMessage(playerid, 0x9EC73DAA, "You don't have enough cash to buy this Weapon."); // Message If Player Dosen't Have Enough Cash
GivePlayerMoney(playerid, -500); GivePlayerWeapon(playerid, 30, 250);
SendClientMessage(playerid, 0x2641FEAA, "You have succesfully buyed a Shownoff - shotgun");
case 1: //-ak-47 { if(GetPlayerMoney(playerid) < 500) return SendClientMessage(playerid, 0x9EC73DAA, "You don't have enough cash to buy this Weapon."); GivePlayerMoney(playerid, -500); GivePlayerWeapon(playerid, 30, 250); SendClientMessage(playerid, 0x2641FEAA, "You have succesfully buyed a Shownoff - shotgun");
//COLOR_WHITE 0xFFFFFFFF //COLOR_GREY 0xAFAFAFAA //COLOR_GREEN 0x9EC73DAA //COLOR_GROVE 0x00FF00FF //COLOR_RED 0xAA3333AA //COLOR_LIGHTRED 0xFF6347AA //COLOR_LIGHTBLUE 0x33CCFFAA //LIGHTGREEN 0x9ACD32AA //COLOR_YELLOW 0xDABB3EAA //COLOR_YELLOW2 0xF5DEB3AA //COLOR_PURPLE 0xC2A2DAAA //COLOR_DBLUE 0x2641FEAA //COLOR_BLUE 0x2641FEAA //COLOR_DARKNICERED 0x9D000096 //COLOR_LIGHT_BLUE 0x9FB1EEAA