SA-MP Forums Archive
What is wrong here?ZCMD - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: What is wrong here?ZCMD (/showthread.php?tid=239311)



What is wrong here?ZCMD - ricardo178 - 13.03.2011

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


Re: What is wrong here?ZCMD - Cameltoe - 13.03.2011

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?


Re: What is wrong here?ZCMD - ricardo178 - 13.03.2011

Coz this is only usable for blue guys

Thanks!


Re: What is wrong here?ZCMD - Cameltoe - 13.03.2011

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

Thanks!
You should consider using GetPlayerTeam instead.