What is wrong here?ZCMD
#1

Hey guys i have made this cmd with an toturial help... It was to make a setcash cmd but i made a /stun one
It work well and show the mensagem to cop and to susect but, to the cop show too a UNCKNOWN COMMAND sentence...
It stun even with this mensage but i want to remove it....
When i compile it show me a warmning too saying this cmd should return a value...

Here's the code:
pawn Код:
COMMAND:stun(playerid, params[])
{
    if(GetPlayerColor(playerid) == 0x0259EAAA)
    {
        new toplayer;
        if(!sscanf(params, "ui", toplayer))
        {
            if(IsPlayerConnected(toplayer))
            {
                new string[64];
                new name[MAX_PLAYER_NAME], PlayerName[MAX_PLAYER_NAME];
                GetPlayerName(playerid, name, sizeof(name));
                GetPlayerName(toplayer, PlayerName, sizeof(PlayerName));
                format(string, sizeof(string), "Cop %s Has Stun You", name);
                SendClientMessage(playerid, 0x0259EAAA, string);
                format(string, sizeof(string), "You Has Stun %s", PlayerName);
                SendClientMessage(playerid, 0x0259EAAA, string);
                TogglePlayerControllable(playerid, 0);
            }
            else return SendClientMessage(playerid, 0x0259EAAA, "Player Is Not Conected.");
        }
        else return SendClientMessage(playerid, 0x0259EAAA, "USAGE: /stun [PlayerId/PartOfName]");
    }
    else return SendClientMessage(playerid, 0x0259EAAA, "Only Cops Can Use This Command.");
}
THANKS
Reply
#2

pawn Код:
COMMAND:stun(playerid, params[])
{
    if(GetPlayerColor(playerid) == 0x0259EAAA)
    {
        new toplayer;
        if(!sscanf(params, "ui", toplayer))
        {
            if(IsPlayerConnected(toplayer))
            {
                new string[64];
                new name[MAX_PLAYER_NAME], PlayerName[MAX_PLAYER_NAME];
                GetPlayerName(playerid, name, sizeof(name));
                GetPlayerName(toplayer, PlayerName, sizeof(PlayerName));
                format(string, sizeof(string), "Cop %s Has Stun You", name);
                SendClientMessage(playerid, 0x0259EAAA, string);
                format(string, sizeof(string), "You Has Stun %s", PlayerName);
                SendClientMessage(playerid, 0x0259EAAA, string);
                TogglePlayerControllable(playerid, 0);
                return 1;
            }
            else return SendClientMessage(playerid, 0x0259EAAA, "Player Is Not Conected.");
        }
        else return SendClientMessage(playerid, 0x0259EAAA, "USAGE: /stun [PlayerId/PartOfName]");
    }
    else return SendClientMessage(playerid, 0x0259EAAA, "Only Cops Can Use This Command.");
}
Why do you use GetPlayerColor?
Reply
#3

Coz this is only usable for blue guys

Thanks!
Reply
#4

Quote:
Originally Posted by ricardo178
Посмотреть сообщение
Coz this is only usable for blue guys

Thanks!
You should consider using GetPlayerTeam instead.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)