14.03.2010, 20:49
Can someone help me with making this command into a menu....Right now it shows up as a client message
Код:
if(strcmp(cmd,"/buy",true)==0) { if(IsSpawned[playerid] == 0) { SendClientMessage(playerid, COLOR_ERROR, "You are dead. You cannot use this command"); return 1; } if (!IsPlayerInDynamicCP(playerid, gCheckpoint[15])){ SendClientMessage(playerid,COLOR_ERROR,"You have to be in the checkpoint inside a 24/7 store to use this command"); return 1; } if (!IsPlayerInDynamicCP(playerid, gCheckpoint[15])){ SendClientMessage(playerid,COLOR_ERROR,"You have to be in the checkpoint inside a 24/7 store to use this command"); return 1; } TogglePlayerDynamicCP(playerid, 15, true); { new buyername[24]; GetPlayerName(playerid,buyername, 24); new x_nr[256]; x_nr = strtok(cmdtext, idx); if(!strlen(x_nr)) { SendClientMessage(playerid, COLOR_ERROR, "USAGE: /buy 1-6"); return 1; } if(strcmp(x_nr,"1",true) == 0) { if(GetPlayerMoney(playerid) <= 1499) { SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase Failed_|"); SendClientMessage(playerid, COLOR_ERROR, "You cannot afford to buy a Chainsaw ($2000)"); return 1; } GivePlayerMoney(playerid,-1500); SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase_|"); SendClientMessage(playerid, 0x00C7FFAA, "You have bought a Chainsaw. You were charged $1500"); GivePlayerWeapon(playerid,9,1); } else if(strcmp(x_nr,"2",true) == 0) { if(GetPlayerMoney(playerid) <= 4) { SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase Failed_|"); SendClientMessage(playerid, COLOR_ERROR, "You cannot afford to buy flowers ($5)"); return 1; } GivePlayerMoney(playerid,-5); SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase_|"); SendClientMessage(playerid, 0x00C7FFAA, "You have bought flowers. You were charged $5"); GivePlayerWeapon(playerid,14,1); } else if(strcmp(x_nr,"3",true) == 0) { if(GetPlayerMoney(playerid) <= 99) { SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase Failed_|"); SendClientMessage(playerid, COLOR_ERROR, "You cannot afford to buy a Baseball Bat ($100)"); return 1; } GivePlayerMoney(playerid,-100); SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase_|"); SendClientMessage(playerid, 0x00C7FFAA, "You have bought a Baseball Bat. You were charged $100"); GivePlayerWeapon(playerid,5,1); } else if(strcmp(x_nr,"4",true) == 0) { if(GetPlayerMoney(playerid) <= 19) { SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase Failed_|"); SendClientMessage(playerid, COLOR_ERROR, "You cannot afford to buy Beer ($20)"); return 1; } GivePlayerMoney(playerid,-20); SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase_|"); SendClientMessage(playerid, 0x00C7FFAA, "You have bought Beer. You were charged $20"); new Float:beerhealth; GetPlayerHealth(playerid,beerhealth); if(beerhealth <=95) { SetPlayerHealth(playerid,beerhealth+5); } } else if(strcmp(x_nr,"5",true) == 0) { if(GetPlayerMoney(playerid) <= 999) { SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase Failed_|"); SendClientMessage(playerid, COLOR_ERROR, "You cannot afford to buy a Wallet ($1000)"); return 1; } if(HasWallet[playerid] >= 1) { SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase Failed_|"); SendClientMessage(playerid, COLOR_ERROR, "You already have a Wallet"); return 1; } GivePlayerMoney(playerid,-1000); SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase_|"); SendClientMessage(playerid, 0x00C7FFAA, "You have bought a Wallet. You were charged $1000"); SendClientMessage(playerid, 0x00C7FFAA, "You can be robbed upto 3 times and not loose any cash"); HasWallet[playerid] =3; } else if(strcmp(x_nr,"6",true) == 0) { if(GetPlayerMoney(playerid) <= 499) { SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase Failed_|"); SendClientMessage(playerid, COLOR_ERROR, "You cannot afford to buy a Parachute ($500)"); return 1; } GivePlayerMoney(playerid,-500); SendClientMessage(playerid, 0xA9A9A9AA, "|_24/7 Purchase_|"); SendClientMessage(playerid, 0x00C7FFAA, "You have bought a Parachute. You were charged $500"); GivePlayerWeapon(playerid,46,1); } else { SendClientMessage(playerid, COLOR_ERROR, "USAGE: /buy 1-6"); return 1; } } return 1; }