26.05.2014, 02:06
(
Последний раз редактировалось Josh_Main; 21.09.2016 в 05:53.
)
Small gun store system
Requirements
I will add some captions for beginners;
At the top of your script (Make sure you have the include)
You will also need to define the dialog we are creating;
The command;
Under OnDialogResponse;
If this is your last dialog, make sure you return 0.
I also created a quick teleport command so you can teleport straight to the interiors to test it out, if you want this, add it to your script.
If you find any bugs in this script, please let me know. Also, if I have done anything wrong feel free to correct me as I am only learning
P.s I have also created a small /buydrinks system aswell, if you want it PM me and ill send you the code
Thanks, have fun!
Requirements
- - zcmd
I will add some captions for beginners;
At the top of your script (Make sure you have the include)
Код:
#include <zcmd>
Код:
#define DIALOGWEAPONS 1
Код:
CMD:buyguns(playerid, params[]) { if(IsPlayerInRangeOfPoint(playerid, 40, 286.148986,-40.644397,1001.515625) || IsPlayerInRangeOfPoint(playerid, 40, 286.800994,-82.547599,1001.515625) || IsPlayerInRangeOfPoint(playerid, 40, 296.919982,-108.071998,1001.515625) || IsPlayerInRangeOfPoint(playerid, 40, 314.820983,-141.431991,999.601562) || IsPlayerInRangeOfPoint(playerid, 40, 316.524993,-167.706985,999.593750)) ShowPlayerDialog(playerid, DIALOGWEAPONS, DIALOG_STYLE_LIST, "Hello, what guns can I get you?", "Deagle(15k)\nShotgun(2.5k)\nMP5(5k)\nSpas12(170k)\n(50k)\n(60k)\nSniper(150k)\nHalf vest(10k)\nFull vest(20k)","Buy","Cancel"); return 1; }
Код:
if(dialogid == DIALOGWEAPONS) { if(response) { switch(listitem) { case 0: { if(GetPlayerMoney(playerid) <1500) return SendClientMessage(playerid, COLOR_GRAD, "You don't have enough money to buy this item!"); SendClientMessage(playerid, COLOR_GRAD, "You bought a deagle for 15k!"); GivePlayerMoney(playerid, -1500); GivePlayerWeapon(playerid,24, 9999999); } case 1: { if(GetPlayerMoney(playerid) <2500) return SendClientMessage(playerid, COLOR_GRAD, "You don't have enough money to buy this item!"); SendClientMessage(playerid, COLOR_GRAD, "You bought a shotgun for 2.5k!"); GivePlayerMoney(playerid, -2500); GivePlayerWeapon(playerid, 25, 9999999); } case 2: { if(GetPlayerMoney(playerid) <5000) return SendClientMessage(playerid, COLOR_GRAD, "You don't have enough money to buy this item!"); SendClientMessage(playerid, COLOR_GRAD, "You bought an MP5 for 5k!"); GivePlayerMoney(playerid, -5000); GivePlayerWeapon(playerid, 29 ,9999999); } case 3: { if(GetPlayerMoney(playerid) <170000) return SendClientMessage(playerid, COLOR_GRAD, "You don't have enough money to buy this item!"); SendClientMessage(playerid, COLOR_GRAD, "You bought a spas12 for 170k!"); GivePlayerMoney(playerid, -170000); GivePlayerWeapon(playerid, 27, 9999999); } case 4: { if(GetPlayerMoney(playerid) <50000) return SendClientMessage(playerid, COLOR_GRAD, "You don't have enough money to buy this item!"); SendClientMessage(playerid, COLOR_GRAD, "You bought an for 50k!"); GivePlayerMoney(playerid, -50000); GivePlayerWeapon(playerid,30 ,9999999); } case 5: { if(GetPlayerMoney(playerid) <60000) return SendClientMessage(playerid, COLOR_GRAD, "You don't have enough money to buy this item!"); SendClientMessage(playerid, COLOR_GRAD, "You bought an for 60k!"); GivePlayerMoney(playerid, -60000); GivePlayerWeapon(playerid, 31, 9999999); } case 6: { if(GetPlayerMoney(playerid) <150000) return SendClientMessage(playerid, COLOR_GRAD, "You don't have enough money to buy this item!"); SendClientMessage(playerid, COLOR_GRAD, "You bought a sniper for 150k!"); GivePlayerMoney(playerid, -150000); GivePlayerWeapon(playerid, 34, 9999999); } case 7: { if(GetPlayerMoney(playerid) <10000) return SendClientMessage(playerid, COLOR_GRAD, "You don't have enough money to buy this item!"); new Float:armour; GetPlayerArmour(playerid, armour); if(armour == 100) return SendClientMessage(playerid, COLOR_GRAD,"You already have a full vest!"); SendClientMessage(playerid, COLOR_GRAD, "You bought a half vest for 10k!"); GivePlayerMoney(playerid, -10000); SetPlayerArmour(playerid, 50); } case 8: { if(GetPlayerMoney(playerid) <20000) return SendClientMessage(playerid, COLOR_GRAD, "You don't have enough money to buy this item!"); new Float:armour; GetPlayerArmour(playerid, armour); if(armour == 100) return SendClientMessage(playerid, COLOR_GRAD, "You already have a full vest!"); SendClientMessage(playerid, COLOR_GRAD, "You bought a full vest for 20k!"); GivePlayerMoney(playerid, -20000); SetPlayerArmour(playerid, 100); } } return 1; } }
I also created a quick teleport command so you can teleport straight to the interiors to test it out, if you want this, add it to your script.
Код:
CMD:gunstore(playerid, params[]) { if(strcmp(params,"1",true) == 0) { SetPlayerPos(playerid, 286.148986,-40.644397,1001.515625); SetPlayerInterior(playerid, 1); GivePlayerMoney(playerid, 50000); } else if(strcmp(params,"2",true) == 0) { SetPlayerPos(playerid, 286.800994,-82.547599,1001.515625); SetPlayerInterior(playerid, 4); } else if(strcmp(params, "3",true) == 0) { SetPlayerPos(playerid, 296.919982,-108.071998,1001.515625); SetPlayerInterior(playerid, 6); } else if(strcmp(params, "4",true) == 0) { SetPlayerPos(playerid, 314.820983,-141.431991,999.601562); SetPlayerInterior(playerid, 7); } else if(strcmp(params, "5",true) == 0) { SetPlayerPos(playerid, 316.524993,-167.706985,999.593750); SetPlayerInterior(playerid, 6); } return 1; }
P.s I have also created a small /buydrinks system aswell, if you want it PM me and ill send you the code
Thanks, have fun!