OnPlayerSpawn
#1

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?
Reply
#2

Are you missing an else? What is with the braces following the first if statement (ie, why are you creating a new scope?).
Reply
#3

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..
Reply
#4

Can someone help me with this?
Reply
#5

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?
Reply
#6

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....
Reply
#7

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)