SA-MP Forums Archive
Suspect Problem - 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: Suspect Problem (/showthread.php?tid=317819)



Suspect Problem - Daniel_Dani - 12.02.2012

How to make when a player leave the server with wanted next time when he login spawn him at jail?


Re: Suspect Problem - ReneG - 12.02.2012

First you need a way of saving account stats.

Second, you can define variables.

Example:
pawn Код:
new IsJailed = 0
public OnPlayerDisconnect(playerid)
{
    if(GetPlayerWantedLevel(playerid) > 3)
    {
        IsJailed = 1;
                   //If a player logs off with a wanted level greater than 3. Then the IsJailed would be set to 1 or yes.
    }
    return 1;
}
public OnPlayerSpawn(playerid)
{
    if(IsJailed == 1)
    {
        SetPlayerPos(playerid,You would put the jail coordinates here);
        SetTimer("JailTime",60000,false); //If a player's variable IsJailed is set to 1 or yes then it will set a timer of 60 seconds.
    }
}
forward JailTime(playerid);
public JailTime(playerid)
{
    SetPlayerPos(playerid,you eould put the release coords here.);
    IsJailed = 0; //After those sixty seconds are up. They will be released and heir IsJailed would be set to 0 or 'no'.
}



Re: Suspect Problem - [ABK]Antonio - 13.02.2012

Quote:
Originally Posted by VincentDunn
Посмотреть сообщение
First you need a way of saving account stats.

Second, you can define variables.

Example:
pawn Код:
new IsJailed = 0
public OnPlayerDisconnect(playerid)
{
    if(GetPlayerWantedLevel(playerid) > 3)
    {
        IsJailed = 1;
                   //If a player logs off with a wanted level greater than 3. Then the IsJailed would be set to 1 or yes.
    }
    return 1;
}
public OnPlayerSpawn(playerid)
{
    if(IsJailed == 1)
    {
        SetPlayerPos(playerid,You would put the jail coordinates here);
        SetTimer("JailTime",60000,false); //If a player's variable IsJailed is set to 1 or yes then it will set a timer of 60 seconds.
    }
}
forward JailTime(playerid);
public JailTime(playerid)
{
    SetPlayerPos(playerid,you eould put the release coords here.);
    IsJailed = 0; //After those sixty seconds are up. They will be released and heir IsJailed would be set to 0 or 'no'.
}
You need to add [MAX_PLAYERS] to that, and use isJailed[playerid] or it will be a global variable (aka for everyone).


Re: Suspect Problem - ReneG - 13.02.2012

Quote:
Originally Posted by [ABK]Antonio
Посмотреть сообщение
You need to add [MAX_PLAYERS] to that, and use isJailed[playerid] or it will be a global variable (aka for everyone).
Thank you for correcting me on that.