Help me with creating this type of command. - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help me with creating this type of command. (
/showthread.php?tid=270280)
Help me with creating this type of command. -
Shockey HD - 19.07.2011
Like alot of commands i want it so it will be like /givemoney <ID> <Money> Can anyone help me?
Re: Help me with creating this type of command. -
Raimis_R - 19.07.2011
You using strcmp, zcmd. ycmd or.. ?
Re: Help me with creating this type of command. -
Shockey HD - 19.07.2011
dcmd
Re: Help me with creating this type of command. -
Raimis_R - 19.07.2011
if you usind dcmd and sscanf:
pawn Code:
dcmd_givemoney(playerid, params[])
{
new id, money;
if (sscanf(params, "ui", id, money)) return SendClientMessage(playerid, -1,"Usage: /givemoney id ammount");
if (id == INVALID_PLAYER_ID) // Send Error Message..
// More stuff
GivePlayerMoney(id, money);
// More stuff
return 1;
}
Re: Help me with creating this type of command. -
linuxthefish - 19.07.2011
It's even on the wiki, how hard is it to search?
https://sampwiki.blast.hk/wiki/Fast_Commands#givecash
Re: Help me with creating this type of command. -
Shockey HD - 19.07.2011
Quote:
Originally Posted by linuxthefish
|
Thats not answering my Questions. My question how would i create Something like that. One that you have to do
/command <ID> [reason or value]
I do have this command
Code:
dcmd_payday(playerid,params[])
{
new
giveplayerid,
amount;
new id,n[MAX_PLAYER_NAME],on[MAX_PLAYER_NAME];
new tmp[256], Index, str[49];
tmp = strtok(params,Index), id = strval(tmp);
GetPlayerName(id,on,sizeof(on));
GetPlayerName(playerid,n,sizeof(n));
if(PInfo[playerid][Level] < 2) return SendClientMessage(playerid,COLOR_RED,"You need to be level 3 Admin to use this command!");
if(!strlen(params)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /payday <ID> <Ammount>");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid,COLOR_RED,"Invalid ID");
format(str,sizeof(str),"Admin %s has gave %s money for playing today!",n,on);
SendClientMessageToAll(LIGHTBLUE,str);
GivePlayerMoney(giveplayerid, amount);
GivePlayerMoney(playerid, 0 - amount);
return 1;
}
But it dosnt give any money