Any idea REP++
#1

Why this doesnt work?

pawn Код:
CMD:agivecash(playerid, params[])
{
    new id, money;
    if(PlayerInfo [playerid][pAdmin] < 1)return SendClientMessage(playerid, COLOR_WHITE, "You need to be a admin to use that command!");
    else if(sscanf(params, "ud", id, money))SendClientMessage(playerid, COLOR_WHITE, "Usage: /agivecash [id/name][cash]");
    else if (id==INVALID_PLAYER_ID)SendClientMessage(playerid,COLOR_WHITE,"Error: Player is not connected!");
    else if (money > 100000)SendClientMessage(playerid,COLOR_WHITE,"Error: Max money to send: 100000");
    else {
        new To[128], From[128];
        format(To, sizeof(To), "Admin %s(%d) has sended you %s of cash!", GetName(playerid), playerid, money);
        SendClientMessage(id,COLOR_PINK, To);
        format(From, sizeof(From), "You have sended %s of admin money to %s(%d)!", money, GetName(id),id);
        SendClientMessage(id,COLOR_PINK, From);
        GivePlayerMoney(id, money);
    }
    return 1;
}

CMD:gc(playerid, params[])
{
    new id, money, mymoney;
    mymoney = GetPlayerMoney(playerid);
    if(sscanf(params, "uu", id, money))SendClientMessage(playerid, COLOR_WHITE, "Usage: /gc [id/name][cash]");
    else if (id==INVALID_PLAYER_ID)SendClientMessage(playerid,COLOR_WHITE,"Error: Player is not connected!");
    else if (money > 100000)SendClientMessage(playerid,COLOR_WHITE,"Error: Max money to send: 100000");
    else if (mymoney < money)SendClientMessage(playerid,COLOR_WHITE,"Error: You dont have this mouch of money!");
    else {
        new To[128], From[128];
        format(To, sizeof(To), "%s(%d) has sended you %s of cash!", GetName(playerid), playerid, money);
        SendClientMessage(id,COLOR_PINK, To);
        format(From, sizeof(From), "You have sended %s of money to %s(%d)!", money, GetName(id),id);
        SendClientMessage(id,COLOR_PINK, From);
        GivePlayerMoney(id, money);
        GivePlayerMoney(playerid, mymoney-money);
    }
    return 1;
}

CMD:setscore(playerid, params[])
{
    new id, money;
    if(PlayerInfo [playerid][pAdmin] < 4)return SendClientMessage(playerid, COLOR_WHITE, "You need to be admin lvl 4 to use that command!");
    else if(sscanf(params, "uu", id, money))SendClientMessage(playerid, COLOR_WHITE, "Usage: /setscore [id/name][score]");
    else if (id==INVALID_PLAYER_ID)SendClientMessage(playerid,COLOR_WHITE,"Error: Player is not connected!");
    else if (id==playerid)SendClientMessage(playerid,COLOR_WHITE,"Error: You cant use this command on yourself!");
    else {
        new To[128], From[128];
        format(To, sizeof(To), "Admin %s(%d) has set your score to: %s.", GetName(playerid), playerid, money);
        SendClientMessage(id,COLOR_PINK, To);
        format(From, sizeof(From), "You have set %s score to %s(%d)!", money, GetName(id),id);
        SendClientMessage(id,COLOR_PINK, From);
        SetPlayerScore(id, money);
    }
    return 1;
}
WHen i execute it, nothing happens
Reply
#2

#1: Money is an integer, so instead of %s use %d
#2: In CMD:gc and CMDetscore, you define money as a player in sscanf ("uu"). You should use "ud"

I also recommend you to make sure your formats are OK.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)