Commands dosen't work
#7

Quote:
Originally Posted by RedJohn
Посмотреть сообщение
At the ZCMD you don't need this:
Код:
CMD:setmoney(playerid, params[], help)
Change
pawn Код:
#pragma unused help
to
pawn Код:
#pragma unused params
There is no GetName function unless you create one.

Add this:
pawn Код:
PlayerName(p)
{
   static name[MAX_PLAYER_NAME];
   GetPlayerName(p, name, sizeof name);
   return name;
}
at the top, and when you need to use it just add PlayerName(playerid).
For example:
pawn Код:
if(sscanf(params,"ui", id, cash)) return SendClientMessage(playerid, WHITE,"Use: /setmoney [ID] [Ammount]");
        else if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, WHITE, "Wrong id");
        ResetPlayerMoney(id);
        GivePlayerMoney(id, cash);
        format(string, sizeof(string),"You have set player %s money on $%d!", PlayerName(id), cash);
        SendClientMessage(playerid,0x00C252FF,string);
        format(string2, sizeof(string2),"Admin %s has set you money on $%d!", PlayerName(playerid), cash);
        SendClientMessage(id, 0x008BD9FF,string2);
Full command:
pawn Код:
CMD:setmoney(playerid, params[])
{
    #pragma unused params
    new id, cash, string[128], string2[128];
    if(IsPlayerAdmin(playerid))
    {
        if(sscanf(params,"ui", id, cash)) return SendClientMessage(playerid, WHITE,"Use: /setmoney [ID] [Ammount]");
        else if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, WHITE, "Wrong id");
        ResetPlayerMoney(id);
        GivePlayerMoney(id, cash);
        format(string, sizeof(string),"You have set player %s money on $%d!", PlayerName(id), cash);
        SendClientMessage(playerid,0x00C252FF,string);
        format(string2, sizeof(string2),"Admin %s has set you money on $%d!", PlayerName(playerid), cash);
        SendClientMessage(id, 0x008BD9FF, string2);
    }
    else SendClientMessage(playerid, RED, "You are not an admin.");
    return 1;
}
He uses YCMD, not ZCMD

Also, at ZCMD you don't need to use
pawn Код:
#pragma unused params
Reply


Messages In This Thread
Commands dosen't work - by _tHe_WoLf_ - 14.09.2012, 18:11
Re: Commands dosen't work - by Lutz - 14.09.2012, 18:16
Re: Commands dosen't work - by RedJohn - 14.09.2012, 18:18
Re: Commands dosen't work - by _tHe_WoLf_ - 14.09.2012, 18:21
Re: Commands dosen't work - by RedJohn - 14.09.2012, 18:29
Re: Commands dosen't work - by _tHe_WoLf_ - 14.09.2012, 18:32
Re: Commands dosen't work - by PawnFox - 14.09.2012, 18:34
Re: Commands dosen't work - by RedJohn - 14.09.2012, 18:35
Re: Commands dosen't work - by _tHe_WoLf_ - 14.09.2012, 18:41
Re: Commands dosen't work - by _tHe_WoLf_ - 15.09.2012, 09:03

Forum Jump:


Users browsing this thread: 2 Guest(s)