SA-MP Forums Archive
SpawnPlayer(); error! - 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: SpawnPlayer(); error! (/showthread.php?tid=318929)



SpawnPlayer(); error! - Twisted_Insane - 17.02.2012

Hey all!

I've made this jail-cmd, so when the timer passed, the player should spawn normally again:
PHP код:
 CMD:jail(playeridparams[])
    {
        if(
PlayerInfo[playerid][pAdmin] >= 4)
        {
            new 
targetidminutesreason[64];
            if(
sscanf(params"riS(No Reason)[64]"targetidminutesreason))
            if(
minutes <= || minutes 60) return SendClientMessage(playeridCOLOR_RED"Minutes can't be less than 0 or more than 60!");
            
//if(targetid == playerid) return SendClientMessage(playerid, COLOR_RED, "You can't jail yourself!");
            
if(PlayerInfo[targetid][pAdmin] > PlayerInfo[playerid][pAdmin]) return SendClientMessage(playeridCOLOR_RED"You can't jail higher level admins!");
            else
            {
                new 
str[128];
                
format(strsizeof(str), "Administrator %s has jailed %s(%d) for %d minutes! Reason: %s"Name(playerid), Name(targetid), minutesreason);
                
JailTimer[targetid] = SetTimer("Unjail"minutes*60*1000false);
                
SetPlayerPos(targetid264.417677.89301001.0391);
                
SetPlayerInterior(playerid6);
                
inJail[targetid] = true;
            }
        }
        else return 
SendClientMessage(playeridCOLOR_RED"You have to be level 4 to use this command!");
        return 
1;
    } 
and:

PHP код:
forward Unjail(playerid);
public 
Unjail(playerid)
{
    
SpawnPlayer(playerid);
    
inJail[playerid] = false;
    
KillTimer(JailTimer[playerid]);

But, when I jail myself 1 minute, after one minute, I do spawn, but around me isn't everything normal, that means, everything's grey around me!:O Look at the picture I've attached!


Re: SpawnPlayer(); error! - Burridge - 17.02.2012

-Derp didn't read the title properly, read below post-


Re: SpawnPlayer(); error! - KviZ - 17.02.2012

You forgot to set player interior after he gets unjailed.


Re: SpawnPlayer(); error! - Twisted_Insane - 17.02.2012

Confused now! The player doesn't spawn in any house, he spawns outside (in the nature, lol)...
So is there also an interior ID for Los Santos? O_O


Re: SpawnPlayer(); error! - Burridge - 17.02.2012

Set the players interior to 0 under OnPlayerSpawn.


Re: SpawnPlayer(); error! - KviZ - 17.02.2012

Set interior to 0, it's the main world interior (i think)


AW: SpawnPlayer(); error! - Tigerkiller - 17.02.2012

in your unjail public do:

SetPlayerInterior(playerid,0);
SetPlayerVirtualWorld(playerid,0);