10.03.2010, 18:52
Ok this is what i have done so far the dialog box is coming up ingame but i need to no how to link the names of the weapons to give then weapon and check they have the cash and give them the weapon.
Could someone give one example for me thankyou.
Could someone give one example for me thankyou.
Код:
if(strcmp(cmdtext,"/buyguns",true)==0) { if(gTeam[playerid] == TEAM_MERC) { if(usingcomp[playerid] == 1) { if(strlen(cmdtext[9]) == 0) { ShowPlayerDialog(playerid, 101, DIALOG_STYLE_LIST, "Buyguns", "nROCKET LAUNCHER -- $20,000\nCOMBAT SHOTGUN -- $15,000\nSNIPER RIFLE -- $15,000\nDESERT EAGLE -- $15,000\nSHOTGUN -- $10,000\nM4 -- $10,000\nHEALTH -- $10,000", "Select", "Cancel"); TogglePlayerControllable(playerid, 0); SetPlayerVirtualWorld(playerid, 0); return 1; } if(strval(cmdtext[9]) == 1) { if(GetPlayerMoney(playerid) >= 20000) { SendClientMessage(playerid, COLOR_OOC, "Computer: You purchased a rocket launcher!"); GivePlayerWeapon(playerid, 36, 5); GivePlayerMoney(playerid, -20000); } } else if(strval(cmdtext[9]) == 2) { if(GetPlayerMoney(playerid) >= 15000) { SendClientMessage(playerid, COLOR_OOC, "Computer: You purchased a combat shotgun!"); GivePlayerWeapon(playerid, 27, 200); GivePlayerMoney(playerid, -15000); } } else if(strval(cmdtext[9]) == 3) { if(GetPlayerMoney(playerid) >= 15000) { SendClientMessage(playerid, COLOR_OOC, "Computer: You purchased a sniper rifle!"); GivePlayerWeapon(playerid, 34, 100); GivePlayerMoney(playerid, -15000); } } else if(strval(cmdtext[9]) == 4) { if(GetPlayerMoney(playerid) >= 15000) { SendClientMessage(playerid, COLOR_OOC, "Computer: You purchased a desert eagle!"); GivePlayerWeapon(playerid, 24, 200); GivePlayerMoney(playerid, -15000); } } else if(strval(cmdtext[9]) == 5) { if(GetPlayerMoney(playerid) >= 10000) { SendClientMessage(playerid, COLOR_OOC, "Computer: You purchased a shotgun!"); GivePlayerWeapon(playerid, 25, 200); GivePlayerMoney(playerid, -10000); } } else if(strval(cmdtext[9]) == 6) { if(GetPlayerMoney(playerid) >= 10000) { SendClientMessage(playerid, COLOR_OOC, "Computer: You purchased a M4!"); GivePlayerWeapon(playerid, 31, 300); GivePlayerMoney(playerid, -10000); } } else if(strval(cmdtext[9]) == 7) { if(GetPlayerMoney(playerid) >= 10000) { SendClientMessage(playerid, COLOR_OOC, "Computer: You purchased health!"); SetPlayerHealth(playerid, 99.0); GivePlayerMoney(playerid, -10000); } } } else SendClientMessage(playerid, COLOR_RED,"You need to use the computer to buy weps !"); } return 1; }