SA-MP Forums Archive
any one know what is wrong here ? - 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: any one know what is wrong here ? (/showthread.php?tid=271826)



any one know what is wrong here ? - Rafa - 26.07.2011

pawn Код:
CMD:givemoney(playerid, params[])
{
    if(IsPlayerAdmin2[playerid] == 2)
    {
        new targetid, amouth[128];
        if(sscanf(params, "ud", targetid, amouth)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /givemoney [id] [money]");
        if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_ORANGE, "That player is not online.");
        GivePlayerMoney(targetid,amouth);
        format(amouth, sizeof(amouth), "Admin gived to u $%d",amouth);
        SendClientMessage(targetid, COLOR_RED, amouth);
    }
    return 1;
}
i tryed many ways but still geting this freaking error:
pawn Код:
error 035: argument type mismatch (argument 2)
Thanks


Re: any one know what is wrong here ? - Shockey HD - 26.07.2011

should it be

Код:
if(IsPlayerAdmin[playerid] == 2)
If not that please show us which line the error is happening.


Re: any one know what is wrong here ? - Rafa - 26.07.2011

dude its not that the reason for the error... :/
the error line is 222 and that line is this one
pawn Код:
GivePlayerMoney(targetid,amouth);



Re: any one know what is wrong here ? - Shockey HD - 26.07.2011

Quote:
Originally Posted by Rafa
Посмотреть сообщение
dude its not that the reason for the error... :/
the error line is 222 and that line is this one
pawn Код:
GivePlayerMoney(targetid,amouth);
You spelt amount wrong.

try
Код:
GivePlayerMoney(giveplayerid, amount)



Re: any one know what is wrong here ? - PrawkC - 26.07.2011

Quote:
Originally Posted by Shockey HD
Посмотреть сообщение
You spelt ammount wrong.

try
Код:
GivePlayerMoney(giveplayerid, amount)
Who cares how he spelled it? He could of had it as dogs.

But your problem is you need to take off the [128] , so just amouth

so like,

new targetid, amouth;


Re: any one know what is wrong here ? - Rafa - 26.07.2011

nope isn't fixed :/
Please someone help !
EDIT: no dude that must stay there


Re: any one know what is wrong here ? - PrawkC - 26.07.2011

Quote:
Originally Posted by Rafa
Посмотреть сообщение
nope isn't fixed :/
Please someone help !
EDIT: no dude that must stay there
It can't stay there.


Re: any one know what is wrong here ? - Crimson - 26.07.2011

add a new variable called "string[128]" and remove the [128] off "amouth"

then change these lines:
Код:
format(string, sizeof(string), "Admin gave you $%d", amouth);
SendClientMessage(targetid, COLOR_RED, string);
should work.


Re: any one know what is wrong here ? - Krx17 - 26.07.2011

You need to convert that array of characters into a numeral. Try this:
pawn Код:
GivePlayerMoney(targetid,strval(amouth));



Re: any one know what is wrong here ? - PrawkC - 26.07.2011

pawn Код:
CMD:givemoney(playerid, params[])
{
   if(IsPlayerAdmin2[playerid] == 2)
    {
        new targetid, amouth, string[128];
        if(sscanf(params, "ud", targetid, amouth)) return SendClientMessage(playerid, -1, "USAGE: /givemoney [id] [money]");
        if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, -1, "That player is not online.");
        GivePlayerMoney(targetid,amouth);
        format(string, sizeof(string), "Admin gived to u $%d",amouth);
        SendClientMessage(targetid, -1, string);
   }
    return 1;
}