SA-MP Forums Archive
Unkown Commad of /jail - 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)
+--- Thread: Unkown Commad of /jail (/showthread.php?tid=434759)



Unkown Commad of /jail - DerickClark - 04.05.2013

Ever time i use dis it say Unkown. command but it still work.
PHP код:
COMMAND:jail(playeridparams[])
{
    new 
PlayerToJailJailTimeReason[128], Msg[128], Name[24], AdminName[24];
    
// Send the command to all admins so they can see it
    
SendAdminText(playerid"/jail"params);
    
// Check if the player has logged in
    
if (APlayerData[playerid][LoggedIn] == true)
    {
        
// Check if the player's admin-level is at least 1
        
if (APlayerData[playerid][PlayerLevel] >= 1)
        {
            if (
sscanf(params"uis[128]"PlayerToJailJailTimeReason)) SendClientMessage(playerid0xFF0000AA"Usage: \"/jail <PlayerToJail> <JailTime> <Reason>\"");
            else
                if (
IsPlayerConnected(PlayerToJail)) // If the player is a valid playerid (he's connected)
                
{
                    
// Jail the player
                    
Police_JailPlayer(PlayerToJailJailTime);
                    
// Get the name of the player who jailed the player
                    
GetPlayerName(playeridAdminNamesizeof(AdminName));
                    
// Get the name of the player who's being sent to jail
                    
GetPlayerName(PlayerToJailNamesizeof(Name));
                    
// Send the jailed player a message who jailed him, why he's been jailed and how long
                    
format(Msg128"You have been jailed by %s %s for %i seconds"AdminLevelName[APlayerData[playerid][PlayerLevel]], AdminNameJailTime);
                    
SendClientMessage(PlayerToJail0xFF0000FFMsg);
                    
format(Msg128"Reason: %s"Reason);
                    
SendClientMessage(PlayerToJail0xFF0000FFMsg);
                    
format(Msg128"{00FF00}You have jailed {FFFF00}%s{00FF00} for {FFFF00}%i{00FF00} seconds"NameJailTime);
                    
SendClientMessage(playerid0xFFFFFFFFMsg);
                }
                else
                    
SendClientMessage(playerid0xFF0000FF"That player isn't online");
        }
        else
            return 
0;
    }
    else
        return 
0;
    
// Let the server know that this was a valid command
    
return 1;




Re: Unkown Commad of /jail - LukisHard - 04.05.2013

pawn Код:
COMMAND:jail(playerid, params[])
{
    new PlayerToJail, JailTime, Reason[128], Msg[128], Name[24], AdminName[24];

    // Send the command to all admins so they can see it
    SendAdminText(playerid, "/jail", params);

    // Check if the player has logged in
    if (APlayerData[playerid][LoggedIn] == true)
    {
        // Check if the player's admin-level is at least 1
        if (APlayerData[playerid][PlayerLevel] >= 1)
        {
            if (sscanf(params, "uis[128]", PlayerToJail, JailTime, Reason)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/jail <PlayerToJail> <JailTime> <Reason>\"");
            else
                if (IsPlayerConnected(PlayerToJail)) // If the player is a valid playerid (he's connected)
                {
                    // Jail the player
                    Police_JailPlayer(PlayerToJail, JailTime);
                    // Get the name of the player who jailed the player
                    GetPlayerName(playerid, AdminName, sizeof(AdminName));
                    // Get the name of the player who's being sent to jail
                    GetPlayerName(PlayerToJail, Name, sizeof(Name));
                    // Send the jailed player a message who jailed him, why he's been jailed and how long
                    format(Msg, 128, "You have been jailed by %s %s for %i seconds", AdminLevelName[APlayerData[playerid][PlayerLevel]], AdminName, JailTime);
                    SendClientMessage(PlayerToJail, 0xFF0000FF, Msg);
                    format(Msg, 128, "Reason: %s", Reason);
                    SendClientMessage(PlayerToJail, 0xFF0000FF, Msg);
                    format(Msg, 128, "{00FF00}You have jailed {FFFF00}%s{00FF00} for {FFFF00}%i{00FF00} seconds", Name, JailTime);
                    SendClientMessage(playerid, 0xFFFFFFFF, Msg);
                    return 1;
                }
                else
                    SendClientMessage(playerid, 0xFF0000FF, "That player isn't online");
        }
        else
            return 0;
    }
    else
        return 0;

    // Let the server know that this was a valid command
    return 0;
}



Re: Unkown Commad of /jail - DerickClark - 04.05.2013

Still not working.


Re: Unkown Commad of /jail - LukisHard - 04.05.2013

pawn Код:
COMMAND:jail(playerid, params[])
{
    new PlayerToJail, JailTime, Reason[128], Msg[128], Name[24], AdminName[24];

    // Send the command to all admins so they can see it
    SendAdminText(playerid, "/jail", params);

    // Check if the player has logged in
    if (!APlayerData[playerid][LoggedIn] == true) return SendClientMessage(playerid,-1,"MSG");
   
        // Check if the player's admin-level is at least 1
    if (APlayerData[playerid][PlayerLevel] < 1) return SendClientMessage(playerid,-1,"MSG");

    if (!sscanf(params, "uis[128]", PlayerToJail, JailTime, Reason)) return SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/jail <PlayerToJail> <JailTime> <Reason>\"");
   
    if (IsPlayerConnected(PlayerToJail)) // If the player is a valid playerid (he's connected)
    {
    // Jail the player
        Police_JailPlayer(PlayerToJail, JailTime);
                    // Get the name of the player who jailed the player
        GetPlayerName(playerid, AdminName, sizeof(AdminName));
                    // Get the name of the player who's being sent to jail
        GetPlayerName(PlayerToJail, Name, sizeof(Name));
                    // Send the jailed player a message who jailed him, why he's been jailed and how long
        format(Msg, 128, "You have been jailed by %s %s for %i seconds", AdminLevelName[APlayerData[playerid][PlayerLevel]], AdminName, JailTime);
        SendClientMessage(PlayerToJail, 0xFF0000FF, Msg);
        format(Msg, 128, "Reason: %s", Reason);
        SendClientMessage(PlayerToJail, 0xFF0000FF, Msg);
        format(Msg, 128, "{00FF00}You have jailed {FFFF00}%s{00FF00} for {FFFF00}%i{00FF00} seconds", Name, JailTime);
        SendClientMessage(playerid, 0xFFFFFFFF, Msg);
        return 1;
    }
    // Let the server know that this was a valid command
    return 0;
}
Try it.
else, i dont know.
but, i tried to help you.


Re: Unkown Commad of /jail - Yashas - 04.05.2013

Why do you return 0; ??Returning 0 will cause Unknown Command.
Just change return 0 to return 1 which tells the command was performed sucessfuly.

You are just doing the reverse.
1 is for success
0 is for fail


Re: Unkown Commad of /jail - DerickClark - 04.05.2013

Still now working.
it don't show the commands

but not the Unkown.


Re: Unkown Commad of /jail - Onfroi - 04.05.2013

Quote:
Originally Posted by DerickClark
Посмотреть сообщение
Still now working.
it don't show the commands

but not the Unkown.
Than the command is wrong scripted, check all those variables. (e.g. Police_JailPlayer)


Re: Unkown Commad of /jail - Pettersen - 04.05.2013

1. Change return 0; to return 1;
2. Sure your admin system working?
3. Sure you are admin?
If no onenof this work i dont know.