Cmd 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: Cmd help (
/showthread.php?tid=433840)
Cmd help -
Michael_Cuellar - 29.04.2013
pawn Код:
CMD:giveweed(playerid,params[])
{
if(PlayerInfo[playerid][pJob] == 1)
{
new targetid,type;
if(sscanf(params, "ud", targetid, type)) return SendClientMessage(playerid, -1, "[Usage]: /giveweed [Part of Name/Player ID] [Amount]");
if(type > PlayerInfo[playerid][pStressweed])return SendClientMessage(playerid,-1,"ERROR: You do not have that much weed!");
if(type > PlayerInfo[playerid][pChronicweed])return SendClientMessage(playerid,-1,"ERROR: You do not have that much weed!");
if(type > PlayerInfo[playerid][pKushweed])return SendClientMessage(playerid,-1,"ERROR: You do not have that much weed!");
if(targetid == playerid)return SendClientMessage(playerid,-1,"ERROR: You cannot give drugs to your self!");
PlayerInfo[playerid][pStressweed] -= type;
PlayerInfo[targetid][pStressweed] +=type;
PlayerInfo[playerid][pChronicweed] -= type;
PlayerInfo[targetid][pChronicweed] +=type;
PlayerInfo[playerid][pKushweed] -= type;
PlayerInfo[targetid][pKushweed] +=type;
}
return 1;
}
how would I make so what you have to type "/giveweed (weedtype) (id) (amount)?
Re: Cmd help -
MattyG - 29.04.2013
You will need to add another letter to the sscanf, like this:
pawn Код:
if(sscanf(params, "dud", type, targetid, amount)) return SendClientMessage(playerid, -1, "[Usage]: /giveweed [Type] [Part of Name/Player ID] [Amount]");
It's up to you what you do with the extra parameter.