Random Spawn is bugged.
#1

Hello, i need some help with my OnPlayerSpawn callback. Here you see my code:

Код:
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;
	}}
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?
Reply
#2

What? There isn't nothing like that you said "Noob spawning.. .blblblblbaaa"? Probably a timer or a different function?
Reply
#3

Код:
public OnPlayerSpawn(playerid) {
	if(PlayerDeath[playerid] == 0) {
		SetPlayerFacingAngle(playerid, 0);
		SetPlayerCameraPos(playerid, 2462.7473,-1756.1539,13.5469); //816
		SetCameraBehindPlayer(playerid);
		return 1;
This is the place where noobies spawn, when they enter my server for the first time. Underneath it, you see the hospital spawn code for if you re-spawn, or with other words die. These two things are sometimes mixed up. Then your spawn at the noobie place instead of at the hospital.
How i can fix it?
Reply
#4

BUMP!
Reply
#5

What happens if a newbie dies? Does he spawn in the newbie spawn place or at the hospital?
Reply
#6

why not set ther spawn info onplayerdaeath to be the hospital?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)