Commands dosen't work
#1

Well I can't stand it anymore. When I want to make something in pawn, always my commands dosen't work. It goes like "Unknown command", though I have it, also I use YCMD for everything, but dosen't work either on Strcpm and ZCMD. Please help!
Reply
#2

We really can't do anything about your commands unless we actually see the code..
Reply
#3

Can you post here one of the command you tried?
Reply
#4

Код:
YCMD:setmoney(playerid, params[], help)
{
    #pragma unused help
    new id, cash, string[128], string2[128];
    if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdmin] >= 3)
    {
        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");
        else
        ResetPlayerMoney(id);
        GivePlayerMoney(id, cash);
        format(string, sizeof(string),"You have set player %s money on $%d!", GetName(id), cash);
        SendClientMessage(playerid,0x00C252FF,string);
        format(string2, sizeof(string2),"Admin %s has set you money on $%d!", GetName(playerid), cash);
        SendClientMessage(id, 0x008BD9FF,string2);
    }
    else SendClientMessage(playerid, RED, "You are not an admin.");
    return 1;
}
For example, by the way, none of them works, never!
Reply
#5

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

I used YCMD, check again.
Reply
#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
#8

I swear at his first post he added this:
pawn Код:
CMD:setmoney(playerid, params[], help)
Reply
#9

Dosen't matter now, I tried the same thing, still dosen't work, it's not the command it's something else.
Reply
#10

Bump, please help, it's driving me crazy.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)