Buydrugs help - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Buydrugs help (
/showthread.php?tid=450538)
Buydrugs help -
RandomDude - 13.07.2013
The variable is
pawn Код:
enum pInfo
{
drugs//the variable that will store the player's amount of drugs he have.
}
Here is the code to check how much drugs you have
pawn Код:
CMD:dinv(playerid,params[])//creating a checkweed cmd.
{
new string[128];//this is the variable which will store the info of the message we will send to the player.
format(string,sizeof(string),"You have %d drugs on you!",PlayerInfo[playerid][drugs]);//formating the message we will send to the player the info of his drugs.
SendClientMessage(playerid,-1,string);//sending the formated message.
return 1;
}
I want to make a little code to /buydrugs amount
Can someone help?
Thanks!
Re: Buydrugs help -
TH3_R3D™ - 13.07.2013
look at
this.
Re: Buydrugs help -
mahdi499 - 13.07.2013
pawn Код:
CMD:buydrugs(playerid. params[])
{
new amount;
if(sscanf(params,"i",amount)) return SendClientMessage(playerid, -1, "USAGE:/buydrugs (Amount)");
if(amount > 0)
{
new str[128];
PlayerInfo[playerid][drugs] = amount;
GivePlayerMoney(playerid, -( amount * 10)); // change 10 for the price of 1 drug
format(str, sizeof(str), " You have Bought %d Drugs", amount);
}
}
Re: Buydrugs help -
RandomDude - 13.07.2013
thanks mahdi499