/giveMoney cmd problem - 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: /giveMoney cmd problem (
/showthread.php?tid=192445)
/giveMoney cmd problem -
iRana - 22.11.2010
Hi guys I make /givemoney cmd but when I type /givemoney it show '/givemoney playerid money' perfect but when I type /givemoney 1 it says server:unknown cmd

?
Here's my coods:
pawn Код:
if (strcmp("/Givemoney", cmdtext, true, 10) == 0)
{
if (PlayerInfo[playerid][pAdminLevel] >= 4)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /GiveMoney [playerid/PartOfName] [Money]");
return 1;
}
giveplayerid = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /GiveMoney [playerid/PartOfName] [Money]");
return 1;
}
new playa;
playa = ReturnUser(tmp);
Values = strval(tmp);
PlayerInfo[giveplayerid][pCash] += Values;
GivePlayerMoney(giveplayerid,Values);
GetPlayerName(playa, giveplayer, sizeof(giveplayer));
format(string,sizeof(string),"*Administrator %s have Give you %d Money!",sendername,Values);
SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string),"* Gave %d Money to %s",Values,giveplayer);
SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
}
}
return 1;
}
Re: /giveMoney cmd problem -
Seven. - 22.11.2010
Use scanff + zcmd / dcmd
Re: /giveMoney cmd problem -
Scenario - 22.11.2010
If you would indent correctly, that code could be a lot easier to read and therefore a lot easier to identify the problem. You should use ZCMD and SSCANF, instead of strcmp and strtock.
Re: /giveMoney cmd problem -
iRana - 22.11.2010
Any tut of it with detail

?
Re: /giveMoney cmd problem -
XePloiT - 22.11.2010
personally i would make it with DCMD+SPLIT...
Re: /giveMoney cmd problem -
Ricardo187 - 22.11.2010
lol.... you just changed raven's rolePlay /money cmd.... This is Raven's cmds script!
You should download ravens(if you dont have the original one) and copy the cmd /money and replace for this! After chnage /money to /givemoney and the: Usage: /money to Usage: /givemoney
Re: /giveMoney cmd problem -
FreshDoubleX - 22.11.2010
ZCMD or DCMD are the best.
Код:
CMD:givemoney(playerid, params[])
{
new otherId;
new amount;
if(PlayerInfo[playerid][pLogged] == 0)
return SendClientMessage(playerid, COLOR_RED, "[Error]: Please login before using this command.");
if(PlayerInfo[playerid][pAdmin] < 1)
return SendClientMessage(playerid, COLOR_RED, ADMIN_CMD_ERROR);
if(!IsPlayerConnected(otherId))
return SendClientMessage(playerid, COLOR_RED, "[Error]: Invalid Player ID.");
if(sscanf(params, "ds", otherId, amount))
{
SendClientMessage(playerid, COLOR_STEELBLUE, "[USAGE]: /givemoney [Playerid] [Amount]");
return true;
}
GetPlayerName(otherId, otherName, sizeof(otherName));
GetPlayerName(playerid, playerName, sizeof(playerName));
format(stri, sizeof(stri), "* Admin %s gave to %s $%d",playerName,PlayerInfo[otherId][pName],amount);
SendClientMessageToAll(COLOR_YELLOW, stri);
GivePlayerMoney(otherId, amount);
return true;
}