OnPlayerSpawn - 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: OnPlayerSpawn (
/showthread.php?tid=80891)
OnPlayerSpawn -
Snyper - 07.06.2009
I have two functions running at the same time, and they're conflicting with each other. This is what I've found out at least.
Quote:
public OnPlayerSpawn(playerid)
{
if(gPlayerLogged[playerid])
{
SetPlayerSpawn(playerid);
}
{
SetPlayerInterior(playerid, 0);
if(WasDeath[playerid] == 1)
{
SetPlayerPos(playerid,1157.4813,-1327.0978,26.7951);
TogglePlayerControllable(playerid, 0);
SetPlayerCameraPos(playerid,1214.2236,-1324.5652,26.9604);
SetPlayerCameraLookAt(playerid,1183.3402,-1324.1967,20.9604);
SendClientMessage(playerid,RED,"[INFO:] You have fallen unconcious and been sent to the hospital. Your weapons have been confiscated.");
RespawnTimer[playerid] = SetTimerEx("RespawnPlayer", 1000, 1, "i", playerid);
rcount[playerid] = 60;
WasDeath[playerid] = 0;
}
}
|
When I spawn, it spawns me normally. But when I set my spawn to be at my house, it bugs up and teles me to the hospital at the SetPlayerPos.
What can I do?
Re: OnPlayerSpawn -
samgreen - 07.06.2009
Are you missing an else? What is with the braces following the first if statement (ie, why are you creating a new scope?).
Re: OnPlayerSpawn -
Snyper - 07.06.2009
When you die, it sets your position to infront of the hospital. Normally when you join on the server though, you can set your spawn point to either the normal place (faction point, cityhall) or your home.
When I set it my home, it makes me fall through the world where my hospital SetPlayerPos is..
Re: OnPlayerSpawn -
Snyper - 07.06.2009
Can someone help me with this?
Re: OnPlayerSpawn -
samgreen - 07.06.2009
Quote:
Originally Posted by Snyper
Can someone help me with this?
|
Post the rest of
OnPlayerSpawn, if it is a lengthy callback use
pastebin. I mentioned a few problems in my first post, do you know how to correct them?
Re: OnPlayerSpawn -
Luka P. - 07.06.2009
There`s no logic in this script,at all.
Why you trying to spawn player when he is already spawned?
pawn Код:
public OnPlayerSpawn(playerid)
{
if(gPlayerLogged[playerid])
{
SetPlayerSpawn(playerid); // Why you spawning player under ON PLAYER SPAWN public?
}
// blah blah....
Re: OnPlayerSpawn -
Snyper - 07.06.2009
I fixed it. It's okay now. The logic was to spawn the player inside the hospital when he dies, but the interior would mess up.
It turned out to be an extra toggle player controllable and moving the player on the outside of the house instead.