Everything is okay but...
#1

Okay I got a problem, I made a admin command and not only admin cmd does not work, it is in ZCMD and when I complie no errors happen it just gives me "Unknown Command" when trying to use it here is a code

pawn Код:
CMD:freeze(playerid, params[])
    {
    if(PlayerInfo[playerid][Admin] >=1) return SendClientMessage(playerid, 0x0259EAAA, "You are not admin");
    {
        new id;
        if(sscanf(params, "u", id))
        {
            if(IsPlayerConnected(id))
            {
                new string[64];
                new name[MAX_PLAYER_NAME], PlayerName[MAX_PLAYER_NAME];
                GetPlayerName(playerid, name, sizeof(name));
                GetPlayerName(id, PlayerName, sizeof(PlayerName));
                format(string, sizeof(string), "Admin Action: Admin %s Has Feeze You", name);
                SendClientMessage(id, 0xFF0000FF, string);
                format(string, sizeof(string), "You Has Freeze %s", PlayerName);
                SendClientMessage(playerid, 0xFF0000FF, string);
                TogglePlayerControllable(id, 0);
                return 1;
            }
            else return SendClientMessage(playerid, 0x0259EAAA, "Player is not connected");
        }
        else return SendClientMessage(playerid, 0x0259EAAA, "USAGE: /freeze [PlayerId/PartOfName]");
    }
}
What is wrong? I even tried to do /me it didnt work either
Reply
#2

pawn Код:
CMD:freeze(playerid, params[])
    {
    if(PlayerInfo[playerid][Admin] >=1) return SendClientMessage(playerid, 0x0259EAAA, "You are not admin");
    {
        new id;
        if(sscanf(params, "u", id))
        {
            if(IsPlayerConnected(id))
            {
                new string[64];
                new name[MAX_PLAYER_NAME], PlayerName[MAX_PLAYER_NAME];
                GetPlayerName(playerid, name, sizeof(name));
                GetPlayerName(id, PlayerName, sizeof(PlayerName));
                format(string, sizeof(string), "Admin Action: Admin %s Has Feeze You", name);
                SendClientMessage(id, 0xFF0000FF, string);
                format(string, sizeof(string), "You Has Freeze %s", PlayerName);
                SendClientMessage(playerid, 0xFF0000FF, string);
                TogglePlayerControllable(id, 0);
                return 1;
            }
            else return SendClientMessage(playerid, 0x0259EAAA, "Player is not connected");
        }
        else return SendClientMessage(playerid, 0x0259EAAA, "USAGE: /freeze [PlayerId/PartOfName]");
    }
   return 1;
}
You forgot the last return. Don't forget that one, otherwise it won't work
Reply
#3

Quote:
Originally Posted by Wesley221
Посмотреть сообщение
pawn Код:
CMD:freeze(playerid, params[])
    {
    if(PlayerInfo[playerid][Admin] >=1) return SendClientMessage(playerid, 0x0259EAAA, "You are not admin");
    {
        new id;
        if(sscanf(params, "u", id))
        {
            if(IsPlayerConnected(id))
            {
                new string[64];
                new name[MAX_PLAYER_NAME], PlayerName[MAX_PLAYER_NAME];
                GetPlayerName(playerid, name, sizeof(name));
                GetPlayerName(id, PlayerName, sizeof(PlayerName));
                format(string, sizeof(string), "Admin Action: Admin %s Has Feeze You", name);
                SendClientMessage(id, 0xFF0000FF, string);
                format(string, sizeof(string), "You Has Freeze %s", PlayerName);
                SendClientMessage(playerid, 0xFF0000FF, string);
                TogglePlayerControllable(id, 0);
                return 1;
            }
            else return SendClientMessage(playerid, 0x0259EAAA, "Player is not connected");
        }
        else return SendClientMessage(playerid, 0x0259EAAA, "USAGE: /freeze [PlayerId/PartOfName]");
    }
   return 1;
}
You forgot the last return. Don't forget that one, otherwise it won't work
After that I get warning 225: unreachable code
Reply
#4

pawn Код:
CMD:freeze(playerid, params[])
{
    if(PlayerInfo[playerid][Admin] < 1) return SendClientMessage(playerid, 0x0259EAAA, "You are not admin");
    {
        new id;
        if(sscanf(params, "u", id)) return SendClientMessage(playerid, 0x0259EAAA, "USAGE: /freeze [PlayerId/PartOfName]");
        if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0x0259EAAA, "Player is not connected");
        new string[64], name[MAX_PLAYER_NAME], PlayerName[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, sizeof(name));
        GetPlayerName(id, PlayerName, sizeof(PlayerName));
        format(string, sizeof(string), "Admin Action: Admin %s(%d) Has Frozen You", name, playerid);
        SendClientMessage(id, 0xFF0000FF, string);
        format(string, sizeof(string), "You Have Frozen %s(%d)", PlayerName, id);
        SendClientMessage(playerid, 0xFF0000FF, string);
        TogglePlayerControllable(id, false);
    }
    return 1;
}
Reply
#5

Quote:
Originally Posted by Donya
Посмотреть сообщение
pawn Код:
CMD:freeze(playerid, params[])
{
    if(PlayerInfo[playerid][Admin] < 1) return SendClientMessage(playerid, 0x0259EAAA, "You are not admin");
    {
        new id;
        if(sscanf(params, "u", id)) return SendClientMessage(playerid, 0x0259EAAA, "USAGE: /freeze [PlayerId/PartOfName]");
        if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0x0259EAAA, "Player is not connected");
        new string[64], name[MAX_PLAYER_NAME], PlayerName[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, sizeof(name));
        GetPlayerName(id, PlayerName, sizeof(PlayerName));
        format(string, sizeof(string), "Admin Action: Admin %s(%d) Has Frozen You", name, playerid);
        SendClientMessage(id, 0xFF0000FF, string);
        format(string, sizeof(string), "You Have Frozen %s(%d)", PlayerName, id);
        SendClientMessage(playerid, 0xFF0000FF, string);
        TogglePlayerControllable(id, false);
    }
    return 1;
}
Fixed the pawn error but Unknown Command IG
Reply
#6

pawn Код:
COMMAND:freeze(playerid, params[])
{
    if(PlayerInfo[playerid][Admin] <= 0) return SendClientMessage(playerid, 0x0259EAAA, "You are not admin");
    {
        new targetid, playername[24], targetname[24];
        if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, 0x0259EAAA, "USAGE: /freeze [PlayerId/PartOfName]");
        else if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, 0x0259EAAA, "Player is not connected");
        {
            GetPlayerName(playerid, playername, sizeof(playername));
            GetPlayerName(targetid, targetname, sizeof(targetname));
           
            format(string, sizeof(string), "Admin Action: Admin %s Has Feeze You", playername);
            SendClientMessage(targetid, 0xFF0000FF, string);
           
            format(string, sizeof(string), "You Has Freeze %s", targetname);
            SendClientMessage(playerid, 0xFF0000FF, string);
           
            TogglePlayerControllable(targetid, false);
        }
    }
    return 1;
}
Reply
#7

Quote:
Originally Posted by CyberGhost
Посмотреть сообщение
pawn Код:
COMMAND:freeze(playerid, params[])
{
    if(PlayerInfo[playerid][Admin] <= 0) return SendClientMessage(playerid, 0x0259EAAA, "You are not admin");
    {
        new targetid, playername[24], targetname[24];
        if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, 0x0259EAAA, "USAGE: /freeze [PlayerId/PartOfName]");
        else if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, 0x0259EAAA, "Player is not connected");
        {
            GetPlayerName(playerid, playername, sizeof(playername));
            GetPlayerName(targetid, targetname, sizeof(targetname));
           
            format(string, sizeof(string), "Admin Action: Admin %s Has Feeze You", playername);
            SendClientMessage(targetid, 0xFF0000FF, string);
           
            format(string, sizeof(string), "You Has Freeze %s", targetname);
            SendClientMessage(playerid, 0xFF0000FF, string);
           
            TogglePlayerControllable(targetid, false);
        }
    }
    return 1;
}
TC-RP.pwn(494) : error 017: undefined symbol "string"
TC-RP.pwn(494) : error 017: undefined symbol "string"
TC-RP.pwn(494) : error 029: invalid expression, assumed zero
TC-RP.pwn(494) : fatal error 107: too many error messages on one line
Reply
#8

oh
pawn Код:
COMMAND:freeze(playerid, params[])
{
    if(PlayerInfo[playerid][Admin] <= 0) return SendClientMessage(playerid, 0x0259EAAA, "You are not admin");
    {
        new targetid, playername[24], targetname[24], string[59];
        if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, 0x0259EAAA, "USAGE: /freeze [PlayerId/PartOfName]");
        else if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, 0x0259EAAA, "Player is not connected");
        {
            GetPlayerName(playerid, playername, sizeof(playername));
            GetPlayerName(targetid, targetname, sizeof(targetname));
           
            format(string, sizeof(string), "Admin Action: Admin %s Has Feeze You", playername);
            SendClientMessage(targetid, 0xFF0000FF, string);
           
            format(string, sizeof(string), "You Has Freeze %s", targetname);
            SendClientMessage(playerid, 0xFF0000FF, string);
           
            TogglePlayerControllable(targetid, false);
        }
    }
    return 1;
}
Reply
#9

Quote:
Originally Posted by CyberGhost
Посмотреть сообщение
oh
pawn Код:
COMMAND:freeze(playerid, params[])
{
    if(PlayerInfo[playerid][Admin] <= 0) return SendClientMessage(playerid, 0x0259EAAA, "You are not admin");
    {
        new targetid, playername[24], targetname[24], string[59];
        if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, 0x0259EAAA, "USAGE: /freeze [PlayerId/PartOfName]");
        else if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, 0x0259EAAA, "Player is not connected");
        {
            GetPlayerName(playerid, playername, sizeof(playername));
            GetPlayerName(targetid, targetname, sizeof(targetname));
           
            format(string, sizeof(string), "Admin Action: Admin %s Has Feeze You", playername);
            SendClientMessage(targetid, 0xFF0000FF, string);
           
            format(string, sizeof(string), "You Has Freeze %s", targetname);
            SendClientMessage(playerid, 0xFF0000FF, string);
           
            TogglePlayerControllable(targetid, false);
        }
    }
    return 1;
}
And again a bloody Unknown Command appearing but no errors in pawn
Reply
#10

pawn Код:
CMD:freeze(playerid, params[])
{
    if(PlayerInfo[playerid][Admin] < 1) return SendClientMessage(playerid, 0x0259EAAA, "You are not admin");
    new id;
    if(sscanf(params, "u", id)) return SendClientMessage(playerid, 0x0259EAAA, "USAGE: /freeze [PlayerId/PartOfName]");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0x0259EAAA, "Player is not connected");
    new string[64], name[MAX_PLAYER_NAME], PlayerName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    GetPlayerName(id, PlayerName, sizeof(PlayerName));
    format(string, sizeof(string), "Admin Action: Admin %s(%d) Has Frozen You", name, playerid);
    SendClientMessage(id, 0xFF0000FF, string);
    format(string, sizeof(string), "You Have Frozen %s(%d)", PlayerName, id);
    SendClientMessage(playerid, 0xFF0000FF, string);
    TogglePlayerControllable(id, false);
    return 1;
}
why did u guys srsly go through that again? this code above is correct.

do you have onplayercommandtext in your script? show me your onplayercommandtext if u have it and show me your onplayercommandrecieved and onplayercommandperformed
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)