give cash
#1

how can i make a /gc command? Here is what i made
pawn Код:
CMD:gc(playerid,params[])
{
        new pname[24], targetid, string[128];
        new cash = strval(tmp2);
        if(IsPlayerLuxAdmin(playerid))
        if(sscanf(params,"u",targetid)) return SendClientMessage(playerid,-1,"USAGE: /gc [playerid]");
        if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, red, "ERROR: That player isn't online!");

        GetPlayerName(targetid, pname, 24);
        GivePlayerMoney(targetid,cash)
        format(string, 128, "** ADMIN CASH: You have been given %s.",cash);
        SendClientMessage(string,0xFF00FFFF, targetid);
        return 1;
}
I get these errors
pawn Код:
(262) : error 017: undefined symbol "tmp2"
(270) : error 035: argument type mismatch (argument 2)
pawn Код:
262: new cash = strval(tmp2);
270: SendClientMessage(string,0xFF00FFFF, targetid);
Reply
#2

Код:
CMD:gc(playerid,params[])
{
        new pname[24], targetid, string[128], tmp[128];
        new cash = strval(tmp2);
        if(IsPlayerLuxAdmin(playerid))
        if(sscanf(params,"u",targetid)) return SendClientMessage(playerid,-1,"USAGE: /gc [playerid]");
        if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, red, "ERROR: That player isn't online!");

        GetPlayerName(targetid, pname, 24);
        GivePlayerMoney(targetid,cash)
        format(string, 128, "** ADMIN CASH: You have been given %s.",cash);
        SendClientMessage(targetid,0xFF00FFFF, string);
        return 1;
}
Should be like this.
Reply
#3

It doesnt give the player money, but no errors

pawn Код:
CMD:gc(playerid,params[])
{
        new pname[24], targetid, string[128], tmp[128];
        new cash = strval(tmp);
        if(IsPlayerLuxAdmin(playerid))
        if(sscanf(params,"u",targetid)) return SendClientMessage(playerid,-1,"USAGE: /gc [playerid]");
        if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, red, "ERROR: That player isn't online!");

        GetPlayerName(targetid, pname, 24);
        GivePlayerMoney(targetid,cash);
        format(string, 128, "** ADMIN CASH: You have been given %s.",cash);
        SendClientMessage(targetid,0xFF00FFFF,string);
        return 1;
}
Reply
#4

Код:
CMD:gc(playerid,params[])
{
        new pname[24], targetid, string[128];
        new cash = strval(params);
        if(IsPlayerLuxAdmin(playerid))
        if(sscanf(params,"u",targetid)) return SendClientMessage(playerid,-1,"USAGE: /gc [playerid]");
        if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, red, "ERROR: That player isn't online!");

        GetPlayerName(targetid, pname, 24);
        GivePlayerMoney(targetid,cash);
        format(string, 128, "** ADMIN CASH: You have been given %s.",cash);
        SendClientMessage(targetid,0xFF00FFFF,string);
        return 1;
}
This way it will work
Reply
#5

If you use sscanf, why don't you use like this:
pawn Код:
CMD:gc(playerid,params[])
{
     new pname[24], cash, targetid, string[128];
     if(!IsPlayerLuxAdmin(playerid)) continue;
     if(sscanf(params,"ui",targetid, cash)) return SendClientMessage(playerid,-1,"USAGE: /gc [playerid] [cash]");
     if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, red, "ERROR: That player isn't online!");

     GetPlayerName(targetid, pname, 24);
     GivePlayerMoney(targetid, cash);
     format(string, 128, "** ADMIN CASH: You have been given $%d.", cash);
     SendClientMessage(targetid,0xFF00FFFF,string);
     return 1;
}
?
Reply
#6

error 024: "break" or "continue" is out of context
Reply
#7

lol really....
pawn Код:
CMD:agivecash(playerid, params[])
{
    if(IsPlayerAdmin(playerid))
    {
        new id, money, name[MAX_PLAYER_NAME], aname[MAX_PLAYER_NAME];
        if(sscanf(params, "ui", id, money)) return SendClientMessage(playerid, 0xCC0000AA, "USAGE: /givecash <id/partofname> <amount>");
        GivePlayerMoney(id, money);

        GetPlayerName(playerid, aname, sizeof(aname));
        GetPlayerName(id, name, sizeof(name));

        format(str,sizeof(str), "Admin %s has given you $%d!", aname, money);
        SendClientMessage(id, -1, str);
        format(str,sizeof(str), "You have given %s $%d!", name, money);
        SendClientMessage(playerid, -1, str);
    }
    else return SendClientMessage(playerid, 0xCC0000AA, "You aren't an admin!");
    return 1;
}
CMD:gc(playerid, params[]) return cmd_agivecash(playerid, params);
Reply
#8

pawn Код:
CMD:gc(playerid,params[])
{
     new pname[24], cash, targetid, string[128];
     if(!IsPlayerLuxAdmin(playerid)) return SendClientMessage(playerid, -1, "Error: You are not admin");
     if(sscanf(params,"ui",targetid, cash)) return SendClientMessage(playerid,-1,"USAGE: /gc [playerid] [cash]");
     if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, red, "ERROR: That player isn't online!");

     GetPlayerName(targetid, pname, 24);
     GivePlayerMoney(targetid, cash);
     format(string, 128, "** ADMIN CASH: You have been given $%d.", cash);
     SendClientMessage(targetid,0xFF00FFFF,string);
     return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)