SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 04/05/2013, 04:32 AM   #1
DerickClark
High-roller
 
Join Date: Jul 2012
Posts: 1,754
Reputation: 14
Default Unkown Commad of /jail

Ever time i use dis it say Unkown. command but it still work.
PHP Code:
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;

DerickClark is offline   Reply With Quote
Old 04/05/2013, 06:30 AM   #2
LukisHard
Little Clucker
 
LukisHard's Avatar
 
Join Date: May 2012
Posts: 47
Reputation: 12
Default Re: Unkown Commad of /jail

pawn Code:
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;
}
__________________
PlayHard
IP: 198.50.195.143:7777

LukisHard is offline   Reply With Quote
Old 04/05/2013, 06:35 AM   #3
DerickClark
High-roller
 
Join Date: Jul 2012
Posts: 1,754
Reputation: 14
Default Re: Unkown Commad of /jail

Still not working.
DerickClark is offline   Reply With Quote
Old 04/05/2013, 06:55 AM   #4
LukisHard
Little Clucker
 
LukisHard's Avatar
 
Join Date: May 2012
Posts: 47
Reputation: 12
Default Re: Unkown Commad of /jail

pawn Code:
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.
__________________
PlayHard
IP: 198.50.195.143:7777

LukisHard is offline   Reply With Quote
Old 04/05/2013, 08:31 AM   #5
Yashas
Gangsta
 
Join Date: Jun 2012
Location: India
Posts: 882
Reputation: 317
Default Re: Unkown Commad of /jail

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
Yashas is offline   Reply With Quote
Old 04/05/2013, 04:26 PM   #6
DerickClark
High-roller
 
Join Date: Jul 2012
Posts: 1,754
Reputation: 14
Default Re: Unkown Commad of /jail

Still now working.
it don't show the commands

but not the Unkown.
DerickClark is offline   Reply With Quote
Old 04/05/2013, 04:31 PM   #7
Onfroi
Banned
 
Join Date: Jan 2012
Location: Dallas, Texas
Posts: 1,509
Reputation: 226
Default Re: Unkown Commad of /jail

Quote:
Originally Posted by DerickClark View Post
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)
Onfroi is offline   Reply With Quote
Old 04/05/2013, 04:39 PM   #8
Pettersen
Big Clucker
 
Pettersen's Avatar
 
Join Date: Apr 2013
Location: San Andreas
Posts: 152
Reputation: 9
Default Re: Unkown Commad of /jail

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.
__________________
Pettersen is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Annoying "Server:Unknown commad: SkizzoTrick1 Scripting Help 5 17/04/2013 08:51 PM
/repair Commad help Young_M Scripting Help 3 09/03/2013 07:09 PM
/makeadmin commad DannySnoopy Help Archive 11 18/08/2011 03:52 PM
help with makeadmin commad [MKD]Max Help Archive 0 15/10/2010 09:08 PM
/veh commad wanTedh Help Archive 17 13/11/2009 07:36 PM


All times are GMT. The time now is 09:56 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.