10.06.2010, 17:35
Hello, i need some help with my OnPlayerSpawn callback. Here you see my code:
If the player dies, he should respawn at the hospital. But sometimes the player spawns at the 'Noob spawning place' instead of the hospital. How i can prevent that the player spawns here?
Код:
public OnPlayerSpawn(playerid) { if(PlayerDeath[playerid] == 0) { SetPlayerFacingAngle(playerid, 0); SetPlayerCameraPos(playerid, 2462.7473,-1756.1539,13.5469); //816 SetCameraBehindPlayer(playerid); return 1; } else { if(random(100) < 50) // 25% { SetPlayerPos(playerid, 2028.7350, -1404.8456, 17.2430); SetPlayerFacingAngle(playerid, 180); SetCameraBehindPlayer(playerid); SetPlayerHealth(playerid, 75.0); SetPlayerInterior(playerid, 0); SetPlayerVirtualWorld(playerid, 0); GivePlayerMoney(playerid, -800); SendClientMessage(playerid, COLOR_RED,"The paramedics have brought you to the hospital."); SendClientMessage(playerid, COLOR_RED,"The medical bill comes around $800. Be carefully next time!"); SetPlayerSkin(playerid, gskin[playerid]); PlayerDeath[playerid] = 0; return 1; } if(random(100) < 50) // 25% { SetPlayerPos(playerid, 1177.1152,-1323.8965,14.0548); SetPlayerFacingAngle(playerid, 270); SetCameraBehindPlayer(playerid); SetPlayerHealth(playerid, 75.0); SetPlayerInterior(playerid, 0); SetPlayerVirtualWorld(playerid, 0); GivePlayerMoney(playerid, -800); SendClientMessage(playerid, COLOR_RED,"The paramedics have brought you to the hospital."); SendClientMessage(playerid, COLOR_RED,"The medical bill comes around $800. Be carefully next time!"); SetPlayerSkin(playerid, gskin[playerid]); PlayerDeath[playerid] = 0; return 1; } return 1; }}