zcmd problems
#1

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

Which line is 596/597?
Reply
#3

They are commented. The GivePlayerMoney is 596
Reply
#4

Nevermind -.-'
Reply
#5

It still does the same thing..
Reply
#6

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).
Reply
#7

Array size too small.
Reply
#8

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

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

Works perfect, thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)