Jail CMD message to all
#1

This is my jail command,how can i set soo everyone gets a message on chat Admin (which admin) jailed(which player) for how long and reason?

PHP код:
// Jail a player
COMMAND:zatvori(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, "/zatvori", 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, "Komanda: \"/Zatvori <Igrač> <Vrijeme> <Razlog>\"");
            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}Zatvorio si {FFFF00}%s{00FF00} za {FFFF00}%i{00FF00} sekundi", Name, JailTime);
                    
SendClientMessage(playerid, 0xFFFFFFFF, Msg);
                }
                else
                    
SendClientMessage(playerid, 0xFF0000FF, "Taj igrač nije online");
        }
        else
            return 
0;
    }
    else
        return 
0;
    
// Let the server know that this was a valid command
    
return 1;
} 
Reply
#2

PHP код:
// Jail a player
COMMAND:zatvori(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, "/zatvori", 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, "Komanda: \"/Zatvori <Igrač> <Vrijeme> <Razlog>\"");
            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}Zatvorio si {FFFF00}%s{00FF00} za {FFFF00}%i{00FF00} sekundi", Name, JailTime);
                    
SendClientMessage(playerid, 0xFFFFFFFF, Msg);
                    
SendClientMessageToAll(0xAA3333AA, "AdmCmd: %s has been jailed by %s for %i seconds, reason: %s."Name,AdminName,JailTime,Reason);
                }
                else
                    
SendClientMessage(playerid, 0xFF0000FF, "Taj igrač nije online");
        }
        else
            return 
0;
    }
    else
        return 
0;
    
// Let the server know that this was a valid command
    
return 1;
} 
Reply
#3

Tnx for the help,will test it and let you know
Reply
#4

I get this error message
Код:
C:\Users\Korisnik\Desktop\Yugoslavia Trucking v.0.3.7\include\PlayerCommands.inc(2829) : error 001: expected token: "-string end-", but found "-identifier-"
C:\Users\Korisnik\Desktop\Yugoslavia Trucking v.0.3.7\include\PlayerCommands.inc(2829) : warning 215: expression has no effect
C:\Users\Korisnik\Desktop\Yugoslavia Trucking v.0.3.7\include\PlayerCommands.inc(2829) : warning 215: expression has no effect
C:\Users\Korisnik\Desktop\Yugoslavia Trucking v.0.3.7\include\PlayerCommands.inc(2829) : warning 215: expression has no effect
C:\Users\Korisnik\Desktop\Yugoslavia Trucking v.0.3.7\include\PlayerCommands.inc(2829) : warning 215: expression has no effect
C:\Users\Korisnik\Desktop\Yugoslavia Trucking v.0.3.7\include\PlayerCommands.inc(2829) : error 001: expected token: ";", but found ")"
C:\Users\Korisnik\Desktop\Yugoslavia Trucking v.0.3.7\include\PlayerCommands.inc(2829) : error 029: invalid expression, assumed zero
C:\Users\Korisnik\Desktop\Yugoslavia Trucking v.0.3.7\include\PlayerCommands.inc(2829) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#5

Show us line 2829
Reply
#6

http://prntscr.com/85awy6
Reply
#7

PHP код:
// Jail a player
COMMAND:zatvori(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, "/zatvori", 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, "Komanda: \"/Zatvori <Igrac> <Vrijeme> <Razlog>\"");
            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}Zatvorio si {FFFF00}%s{00FF00} za {FFFF00}%i{00FF00} sekundi", Name, JailTime);
                    
SendClientMessage(playerid, 0xFFFFFFFF, Msg);
                    
format(Msg, 128, "Player %s has been jailed by %s %s for %i minutes. Reason: %s", Name, AdminLevelName[APlayerData[playerid][PlayerLevel]], AdminName, JailTime, Reason);
                    
SendClientMessageToAll(0xFF0000FF, Msg);
                }
                else
                    
SendClientMessage(playerid, 0xFF0000FF, "Taj igrac nije online");
        }
        else
            return 
0;
    }
    else
        return 
0;
    
// Let the server know that this was a valid command
    
return 1;
} 
Reply
#8

Working,tnx Sjn
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)