Random Spawn is bugged. - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Random Spawn is bugged. (
/showthread.php?tid=153763)
Random Spawn is bugged. -
sean5874 - 10.06.2010
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?
Re: Random Spawn is bugged. -
Jakku - 10.06.2010
What? There isn't nothing like that you said "Noob spawning.. .blblblblbaaa"? Probably a timer or a different function?
Re: Random Spawn is bugged. -
sean5874 - 10.06.2010
Код:
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?
Re: Random Spawn is bugged. -
sean5874 - 11.06.2010
BUMP!
Re: Random Spawn is bugged. -
DJDhan - 11.06.2010
What happens if a newbie dies? Does he spawn in the newbie spawn place or at the hospital?
Re: Random Spawn is bugged. -
(SF)Noobanatior - 11.06.2010
why not set ther spawn info onplayerdaeath to be the hospital?