25.10.2018, 04:17
I am trying to make a paintball system. So, I made a function to give weapons, teleport and change the virtual world and put it under 'OnPlayerSpawn'. However, whenever the player dies and respawns it instantly dies again then respawns then dies again and again. Not sure what's the problem. but here's the code.
Here is the 'pbrespawn' function-
Код:
public OnPlayerSpawn(playerid) { if(pInfo[playerid][pbstatus]==true){ pbrespawn(playerid); } return 1; }
Код:
public pbrespawn(playerid) { new rand; rand=random(4); switch(rand) { case 0: SetPlayerPos(playerid,-1679.0305,1376.4728,12.3906); case 1: SetPlayerPos(playerid,-1641.2963,1401.5313,7.1875); case 2: SetPlayerPos(playerid,-1648.1776,1369.9368,7.1797); case 3: SetPlayerPos(playerid,-1692.3961,1353.3668,9.8047); } GivePlayerWeapon(playerid,pbarena[PB_ACTIVE][wep1],999); GivePlayerWeapon(playerid,pbarena[PB_ACTIVE][wep2],999); SetPlayerHealth(playerid,pbarena[PB_ACTIVE][pbhp]); SetPlayerArmour(playerid,pbarena[PB_ACTIVE][pbarmor]); SetPlayerVirtualWorld(playerid,1); return 1; }