SpawnPlayer(); error!
#1

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!
Reply
#2

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

You forgot to set player interior after he gets unjailed.
Reply
#4

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
Reply
#5

Set the players interior to 0 under OnPlayerSpawn.
Reply
#6

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

in your unjail public do:

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


Forum Jump:


Users browsing this thread: 1 Guest(s)