Help me with creating this type of command.
#1

Like alot of commands i want it so it will be like /givemoney <ID> <Money> Can anyone help me?
Reply
#2

You using strcmp, zcmd. ycmd or.. ?
Reply
#3

dcmd
Reply
#4

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;
}
Reply
#5

It's even on the wiki, how hard is it to search?

https://sampwiki.blast.hk/wiki/Fast_Commands#givecash
Reply
#6

Quote:
Originally Posted by linuxthefish
View Post
It's even on the wiki, how hard is it to search?

https://sampwiki.blast.hk/wiki/Fast_Commands#givecash
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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)