SA-MP Forums Archive
Jail command Time (from seconds to minutes) - 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: Jail command Time (from seconds to minutes) (/showthread.php?tid=593135)



Jail command Time (from seconds to minutes) - xxxSpeedxxx - 02.11.2015

Hello dear friends,so here is the deal.I have this command,it jails in seconds i need it to jail in minutes.Can anyone help me out with this? Rep+1

PHP код:
// Jail a player 
COMMAND:zatvori(playeridparams[]) 

    new 
PlayerToJailJailTimeReason[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]"PlayerToJailJailTimeReason)) SendClientMessage(playerid0xFF0000AA"Komanda: \"/Zatvori <Igrac> <Vrijeme> <Razlog>\""); 
            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"Zatvoren si od %s %s na %i sekundi"AdminLevelName[APlayerData[playerid][PlayerLevel]], AdminNameJailTime); 
                    
SendClientMessage(PlayerToJail0xFF0000FFMsg); 
                    
format(Msg128"Razlog: %s"Reason); 
                    
SendClientMessage(PlayerToJail0xFF0000FFMsg); 
                    
format(Msg128"{00FF00}Zatvorio si {FFFF00}%s{00FF00} za {FFFF00}%i{00FF00} sekundi"NameJailTime); 
                    
SendClientMessage(playerid0xFFFFFFFFMsg); 
                    
format(Msg128"{FF9933}Igrac %s je zatvoren od %s %s na %i sekundi. Razlog: %s"NameAdminLevelName[APlayerData[playerid][PlayerLevel]], AdminNameJailTimeReason); 
                    
SendClientMessageToAll(0xFFFFFFFFMsg); 
                } 
                else 
                    
SendClientMessage(playerid0xFF0000FF"Taj igrac nije online"); 
        } 
        else 
            return 
0
    } 
    else 
        return 
0
    
// Let the server know that this was a valid command 
    
return 1




Re: Jail command Time (from seconds to minutes) - ATGOggy - 02.11.2015

pawn Код:
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)  
                {  
                    JailTime = JailTime * 60;
                    // 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, "Zatvoren si od %s %s na %i sekundi", AdminLevelName[APlayerData[playerid][PlayerLevel]], AdminName, JailTime);  
                    SendClientMessage(PlayerToJail, 0xFF0000FF, Msg);  
                    format(Msg, 128, "Razlog: %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, "{FF9933}Igrac %s je zatvoren od %s %s na %i sekundi. Razlog: %s", Name, AdminLevelName[APlayerData[playerid][PlayerLevel]], AdminName, JailTime, Reason);  
                    SendClientMessageToAll(0xFFFFFFFF, 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;  
}



Re: Jail command Time (from seconds to minutes) - SecretBoss - 02.11.2015

Give us this function

Код:
Police_JailPlayer(PlayerToJail, JailTime)



Re: Jail command Time (from seconds to minutes) - xxxSpeedxxx - 02.11.2015

ATGOggy's works and it jails in minutes,but when i jail someon for example 1m it says the play has been jailed for 60 seconds not minutes.How to solve that?

PHP код:
COMMAND:zatvori(playeridparams[])  
{  
    new 
PlayerToJailJailTimeReason[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]"PlayerToJailJailTimeReason)) SendClientMessage(playerid0xFF0000AA"Komanda: \"/Zatvori <Igrac> <Vrijeme> <Razlog>\"");  
            else 
                if (
IsPlayerConnected(PlayerToJail)) // If the player is a valid playerid (he's connected)  
                
{  
                    
JailTime JailTime 60;
                    
// 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"Zatvoren si od %s %s na %i sekundi"AdminLevelName[APlayerData[playerid][PlayerLevel]], AdminNameJailTime);  
                    
SendClientMessage(PlayerToJail0xFF0000FFMsg);  
                    
format(Msg128"Razlog: %s"Reason);  
                    
SendClientMessage(PlayerToJail0xFF0000FFMsg);  
                    
format(Msg128"{00FF00}Zatvorio si {FFFF00}%s{00FF00} za {FFFF00}%i{00FF00} sekundi"NameJailTime);  
                    
SendClientMessage(playerid0xFFFFFFFFMsg);  
                    
format(Msg128"{FF9933}Igrac %s je zatvoren od %s %s na %i sekundi. Razlog: %s"NameAdminLevelName[APlayerData[playerid][PlayerLevel]], AdminNameJailTimeReason);  
                    
SendClientMessageToAll(0xFFFFFFFFMsg);  
                }  
                else  
                    
SendClientMessage(playerid0xFF0000FF"Taj igrac nije online");  
        }  
        else  
            return 
0;  
    }  
    else  
        return 
0;  
    
// Let the server know that this was a valid command  
    
return 1;  




Re: Jail command Time (from seconds to minutes) - ATGOggy - 02.11.2015

I don't know this language.
Just change all 'sekundi' in the script to the word 'minute,' translated in this language.


Re: Jail command Time (from seconds to minutes) - xxxSpeedxxx - 02.11.2015

It's Croatian sekundi means seconds,and minute minutes.It's not the word that is the problem.I type /jail player time in minutes and reason.Then i get this "Player John was jailed for 60seconds,Reason: example.But i typed 1 minute.Get it?


Re: Jail command Time (from seconds to minutes) - ATGOggy - 03.11.2015

pawn Код:
// 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*60);  
                    // 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, "Zatvoren si od %s %s na %i minutes", AdminLevelName[APlayerData[playerid][PlayerLevel]], AdminName, JailTime);  
                    SendClientMessage(PlayerToJail, 0xFF0000FF, Msg);  
                    format(Msg, 128, "Razlog: %s", Reason);  
                    SendClientMessage(PlayerToJail, 0xFF0000FF, Msg);  
                    format(Msg, 128, "{00FF00}Zatvorio si {FFFF00}%s{00FF00} za {FFFF00}%i{00FF00} minutes", Name, JailTime);  
                    SendClientMessage(playerid, 0xFFFFFFFF, Msg);  
                    format(Msg, 128, "{FF9933}Igrac %s je zatvoren od %s %s na %i minutes. Razlog: %s", Name, AdminLevelName[APlayerData[playerid][PlayerLevel]], AdminName, JailTime, Reason);  
                    SendClientMessageToAll(0xFFFFFFFF, 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;  
}



Re: Jail command Time (from seconds to minutes) - PrO.GameR - 03.11.2015

JailTime = JailTime * 60;
format(Msg, 128, "{00FF00}Zatvorio si {FFFF00}%s{00FF00} za {FFFF00}%i{00FF00} sekundi", Name, JailTime);
SendClientMessage(playerid, 0xFFFFFFFF, Msg);
format(Msg, 128, "{FF9933}Igrac %s je zatvoren od %s %s na %i sekundi. Razlog: %s", Name, AdminLevelName[APlayerData[playerid][PlayerLevel]], AdminName, JailTime, Reason);
simple as that, these lines turn your 1 minute to 60 seconds, change them if you want to show in minutes instead


Re: Jail command Time (from seconds to minutes) - jlalt - 03.11.2015

do the multiplication after sending the messages and change sekundi to minuta
PHP код:
COMMAND:zatvori(playeridparams[])  
{  
    new 
PlayerToJailJailTimeReason[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]"PlayerToJailJailTimeReason)) SendClientMessage(playerid0xFF0000AA"Komanda: \"/Zatvori <Igrac> <Vrijeme> <Razlog>\"");  
            else 
                if (
IsPlayerConnected(PlayerToJail)) // If the player is a valid playerid (he's connected)  
                
{   
                    
// 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"Zatvoren si od %s %s na %i minuta"AdminLevelName[APlayerData[playerid][PlayerLevel]], AdminNameJailTime);  
                    
SendClientMessage(PlayerToJail0xFF0000FFMsg);  
                    
format(Msg128"Razlog: %s"Reason);  
                    
SendClientMessage(PlayerToJail0xFF0000FFMsg);  
                    
format(Msg128"{00FF00}Zatvorio si {FFFF00}%s{00FF00} za {FFFF00}%i{00FF00} minuta"NameJailTime);  
                    
SendClientMessage(playerid0xFFFFFFFFMsg);  
                    
format(Msg128"{FF9933}Igrac %s je zatvoren od %s %s na %i minuta. Razlog: %s"NameAdminLevelName[APlayerData[playerid][PlayerLevel]], AdminNameJailTimeReason);  
                    
SendClientMessageToAll(0xFFFFFFFFMsg);  
                    
JailTime JailTime 60;
                    
// Jail the player  
                    
Police_JailPlayer(PlayerToJailJailTime); 
                }  
                else  
                    
SendClientMessage(playerid0xFF0000FF"Taj igrac nije online");  
        }  
        else  
            return 
0;  
    }  
    else  
        return 
0;  
    
// Let the server know that this was a valid command  
    
return 1;  




Re: Jail command Time (from seconds to minutes) - xxxSpeedxxx - 03.11.2015

Thanks jlalt and all off you for helping me solve this,Repped all