SA-MP Forums Archive
Spawn after kill - 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: Spawn after kill (/showthread.php?tid=603130)



Spawn after kill - ZmaXy - 19.03.2016

When I first time die, it's all ok, but second, third etc. something is wrong
Video says it all.
https://*********/AgcrPLQJWGg

PHP код:
public OnPlayerDeath(playerid, killerid, reason)
{
    
Died[playerid] = 1;
    return (
true);
} 
PHP код:
public OnPlayerSpawn(playerid)
{
    if(
Died[playerid] == 1)
    {
        
DetermineSpawn(playerid);
        
Died[playerid] = 0;
    }
    return 
1;
} 
PHP код:
stock DetermineSpawn(playerid)
{
    if(
PlayerInfo[playerid][pSpawnPos] == 1)
    {
        
SetPlayerPos(playerid, 1728.7363,-1911.9559,13.5632);
        
SetPlayerInterior(playerid, 0);
        
SetPlayerFacingAngle(playerid, 90);
        
SetPlayerVirtualWorld(playerid, 0);
    }
} 
Thanks in advance. Rep +


Re: Spawn after kill - Arshman - 19.03.2016

PHP код:
stock DetermineSpawn(playerid) 
{ 
        
SetPlayerPos(playerid, 1728.7363,-1911.9559,13.5632); 
        
SetPlayerInterior(playerid, 0); 
        
SetPlayerFacingAngle(playerid, 90); 
        
SetPlayerVirtualWorld(playerid, 0); 
} 
Try this code instead of yours

or try this

PHP код:
stock DetermineSpawn(playerid) 
{ 
    if(
PlayerInfo[playerid][pSpawnPos] == 1) 
    { 
        
SetPlayerPos(playerid, 1728.7363,-1911.9559,13.5632); 
        
SetPlayerInterior(playerid, 0); 
        
SetPlayerFacingAngle(playerid, 90); 
        
SetPlayerVirtualWorld(playerid, 0); 
        
PlayerInfo[playerid][pSpawnPos] = 0) 
    } 
} 



Re: Spawn after kill - ZmaXy - 19.03.2016

@Arshman, Dude, you haven't changed anything , you just made ​​worse.
I must use variable for pSpawnPos, and I can't change SpawnPos to "0". Thanks anyway.

Please, someone else? I can't see mistakes in my code. What's wrong?


Re: Spawn after kill - xTURBOx - 19.03.2016

Hmm , try adding this in the kill(and /akill) cmd
Код:
Died[otherid] = 1;
change otherid to the variable used in your command


Re: Spawn after kill - Amunra - 19.03.2016

Quote:
Originally Posted by ZmaXy
Посмотреть сообщение
When I first time die, it's all ok, but second, third etc. something is wrong
Video says it all.
https://*********/AgcrPLQJWGg

PHP код:
public OnPlayerDeath(playerid, killerid, reason)
{
    
Died[playerid] = 1;
    return (
true);
} 
PHP код:
public OnPlayerSpawn(playerid)
{
    if(
Died[playerid] == 1)
    {
        
DetermineSpawn(playerid);
        
Died[playerid] = 0;
    }
    return 
1;
} 
PHP код:
stock DetermineSpawn(playerid)
{
    if(
PlayerInfo[playerid][pSpawnPos] == 1)
    {
        
SetPlayerPos(playerid, 1728.7363,-1911.9559,13.5632);
        
SetPlayerInterior(playerid, 0);
        
SetPlayerFacingAngle(playerid, 90);
        
SetPlayerVirtualWorld(playerid, 0);
    }
} 
Thanks in advance. Rep +
I Think You Forget Re Make this Variable " PlayerInfo[playerid][pSpawnPos] "
You Adding this OnPlayerConnect ?


Re: Spawn after kill - ZmaXy - 19.03.2016

Quote:
Originally Posted by xTURBOx
Посмотреть сообщение
Hmm , try adding this in the kill(and /akill) cmd
Код:
Died[otherid] = 1;
change otherid to the variable used in your command
Yeah man, now work with /akill. Thanks, rep + But when died normally thing is the same...Problem is something in OnPlayerDeath., but what?


Re: Spawn after kill - xTURBOx - 19.03.2016

hmm change return (true) to return 1; onplayerdeath?


Re: Spawn after kill - ZmaXy - 19.03.2016

Problem fixed. I delete "Died" from script, and use only DetermineSpawn in OnPlayerSpawn callback, now all work perfectly.

Thanks guys for helping.