SA-MP Forums Archive
zcmd problems - 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: zcmd problems (/showthread.php?tid=169519)



zcmd problems - ScottCFR - 19.08.2010

I'm still new to zcmd as I've stated a few times today, so I don't know exactly how to fix this.

Код:
(596) : error 035: argument type mismatch (argument 2)
(597) : error 006: must be assigned to an array
pawn Код:
CMD:setcash(playerid, params[])
{
    if(AccountInfo[playerid][AdminLevel] < 1) return SendClientMessage(playerid, 0xFAFAFAFA, "You are not an admin!");
    {
        new str[256], str2[256], id, Name1[MAX_PLAYER_NAME], Name2[MAX_PLAYER_NAME];
        if(sscanf(params, "us", id, str2))
        {
            SendClientMessage(playerid, 0xFF0000FF, "Usage: /setcash <id> <amount>");
            return 1;
        }
        if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: Player not connected");
        {
            GetPlayerName(playerid, Name1, sizeof(Name1));
            GetPlayerName(id, Name2, sizeof(Name2));
            format(str, sizeof(str), "HellBot: %s has had their cash set by: %s! [Ammount: %s]",Name2,Name1,str2);
            SendClientMessageToAll(WHITE, str);
            printf("[ADMIN] Set Cash: %s Amount: %s",Name2,str2);
            ResetPlayerMoney(id);
            GivePlayerMoney(id, str2); // Line 596
            AccountInfo[playerid][Cash] = str2; // Line 597
        }
    }
    return 1;
}



Re: zcmd problems - Toni - 19.08.2010

Which line is 596/597?


Re: zcmd problems - ScottCFR - 19.08.2010

They are commented. The GivePlayerMoney is 596


Re: zcmd problems - Burridge - 19.08.2010

Nevermind -.-'


Re: zcmd problems - ScottCFR - 19.08.2010

It still does the same thing..


Re: zcmd problems - Toni - 19.08.2010

Quote:
Originally Posted by ScottCFR
Посмотреть сообщение
It still does the same thing..
Oh!
I am not sure, just a random shot, try adding in the enum: Cash[50]

(just adding a array to the enum).


Re: zcmd problems - ScottCFR - 19.08.2010

Array size too small.


Re: zcmd problems - Toni - 19.08.2010

Quote:
Originally Posted by ScottCFR
Посмотреть сообщение
Array size too small.
then make it larger...


Re: zcmd problems - PotH3Ad - 20.08.2010

This should fix it...

pawn Код:
CMD:setcash(playerid, params[])
{
    if(AccountInfo[playerid][AdminLevel] < 1) return SendClientMessage(playerid, 0xFAFAFAFA, "You are not an admin!");

    new str[105], id, amount;
    if(sscanf(params, "ud", id, amount))
    {
        return SendClientMessage(playerid, 0xFF0000FF, "Usage: /setcash <playerid/name> <amount>");
    }
    else if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: Player not connected");

    new Name1[MAX_PLAYER_NAME], Name2[MAX_PLAYER_NAME];
    GetPlayerName(playerid, Name1, sizeof(Name1));
    GetPlayerName(id, Name2, sizeof(Name2));
    format(str, sizeof(str), "HellBot: %s has had their cash set by: %s! [Amount: %d]", Name2, Name1, amount);
    SendClientMessageToAll(WHITE, str);
    printf("[ADMIN] Set Cash: %s Amount: %d",Name2, amount);
    ResetPlayerMoney(id);
    GivePlayerMoney(id, amount); // Line 596
    AccountInfo[playerid][Cash] = amount; // Line 597
    return 1;
}



Re: zcmd problems - ScottCFR - 20.08.2010

Works perfect, thanks.