SA-MP Forums Archive
Player is inside of a car, but at the same time he isn't - 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: Player is inside of a car, but at the same time he isn't (/showthread.php?tid=624957)



Player is inside of a car, but at the same time he isn't - BiosMarcel - 25.12.2016

Hello,

When i respawn / put the player into another vehicle, he gets in there, but he is invisible, it is like he isn't inside of the car, also he cant exit it, since he isn't really in there, but camera pos and controlling the vehicle works, just no character model to be seen.

Maybe anyone can tell me what possible reasons could be, because i have no clue.

onPlayerSpawn / onPlayerDeath ar empty, just saying. And before putting the player into the vehicle i check if he is spawned, if not i spawn him. I also make sure he isn't in spectatormode:

PHP код:
spawnPlayer(playerid)
{
    
TogglePlayerSpectating(playerid0);
    
    if(!
IsPlayerSpawned(playerid))
    {
        
SpawnPlayer(playerid);
    }
    
    new 
mode playerMode[playerid];
    switch(
mode)
    {
        case 
GAMEMODE_DM:
        {
            new 
newVehicle CreateVehicle(411modeState[playersMode][spawnX], modeState[playersMode][spawnY], modeState[playersMode][spawnZ], modeState[mode][spawnRotation], -1, -1, -1);
            
SetVehicleVirtualWorld(newVehicleGetPlayerVirtualWorld(playerid));
            
PutPlayerInVehicle(playeridnewVehicle0);
        }
        
//...
    
}

greetings Marcel


Re: Player is inside of a car, but at the same time he isn't - xTURBOx - 26.12.2016

Код:
new mode = playerMode[playerid]; 

    switch(mode) 
    { 
        case GAMEMODE_DM: 
        { 
            new newVehicle = CreateVehicle(411, modeState[playersMode][spawnX], modeState[playersMode][spawnY], modeState[playersMode][spawnZ], modeState[mode][spawnRotation], -1, -1, -1); 
            SetVehicleVirtualWorld(newVehicle, GetPlayerVirtualWorld(playerid)); 
            PutPlayerInVehicle(playerid, newVehicle, 0); 
        } 
        //... 
    }
try putting it inside OnPlayerSpawn


Re: Player is inside of a car, but at the same time he isn't - BiosMarcel - 26.12.2016

That's not an option because the player doesn't neccessarily have to die to be "respawned"

Edit: NVM i could just call "SpawnPlayer" (onPlayerSpawn) which then calls "spawnPlayer" ... gonna try that