SA-MP Forums Archive
When a player types /acceptdeath they see ground? - 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: When a player types /acceptdeath they see ground? (/showthread.php?tid=225428)



When a player types /acceptdeath they see ground? - Zack9764 - 13.02.2011

I made a CMD so when they /acceptdeath from respawning in their location, it puts them in the hospital but they can't see anything. They see like grass, or land or something.

Code:
if(strcmp(cmd, "/acceptdeath", true) == 0)
	{
	    if (IsDead[playerid] == 1)
	    {
     		new Float:X,Float:Y,Float:Z;
			GetPlayerPos(playerid, X, Y, Z);
   			DropWeapons(GetPlayerWeapon(playerid),GetPlayerAmmo(playerid),X,Y,Z,GetPlayerVirtualWorld(playerid),playerid);
		    ResetPlayerWeaponsEx(playerid);
    	    SetPlayerToTeamColor(playerid);
	        TogglePlayerControllable(playerid,false);
	        SetPlayerHealthEx(playerid,1.0);
	        SetPlayerPos(playerid, -3451.3801,475.9214,58.0620);
	        TogglePlayerControllable(playerid, 0);
	        new RandomWeth;
			RandomWeth = random(2);
	    	switch(RandomWeth)
	    	{
	            case 0:
	            {
	                SetPlayerVirtualWorld(playerid,1);
	       	    }
	            case 1:
	       	    {
	       	        SetPlayerVirtualWorld(playerid,2);
	            }
			}
	        GameTextForPlayer(playerid,"~w~~n~~n~~n~~n~~n~~n~~n~~n~~n~You need to rest now, please wait",8000,3);
		    SetTimerEx("AfterSpawnHos", 10000, false, "i", playerid);
		    ApplyAnimationEx(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
		    Hospitalized[playerid] = 1;
			return 1;
		}
	}



Re: When a player types /acceptdeath they see ground? - JaTochNietDan - 13.02.2011

Are you setting the players interior to the interior of the hospital? Otherwise the player will not see the objects in the hospital, and it will be all blank. You need to find the interior of the hospital, then set the players interior to that of the hospital using SetPlayerInterior(playerid, interior);


Re: When a player types /acceptdeath they see ground? - SkizzoTrick - 13.02.2011

This happened to me too,their SA is getting buggy and theyll need to restart it.It happened because the objects needed to get loaded too fast
Put there a timer like
pawn Code:
public OnPlayerDeath(...)
{
       Dead[playerid] = 1;
       return 1;
}

if(strcmp(cmd, "/acceptdeath", true) == 0)
    {
        if (IsDead[playerid] == 1)
        {
                SetTimerEx("ReloadPos",4000,false,"i",playerid);
            new RandomWeth;
            RandomWeth = random(2);
            switch(RandomWeth)
            {
                case 0:
                {
                    SetPlayerVirtualWorld(playerid,1);
                }
                case 1:
                {
                    SetPlayerVirtualWorld(playerid,2);
                }
        return 1;
        }
    }

public ReloadPos(...)
{   new Float:X,Float:Y,Float:Z;
            GetPlayerPos(playerid, X, Y, Z);
            DropWeapons(GetPlayerWeapon(playerid),GetPlayerAmmo(playerid),X,Y,Z,GetPlayerVirtualWorld(playerid),playerid);
            ResetPlayerWeaponsEx(playerid);
            SetPlayerToTeamColor(playerid);
            TogglePlayerControllable(playerid,false);
            SetPlayerHealthEx(playerid,1.0);
            SetPlayerPos(playerid, -3451.3801,475.9214,58.0620);
    SetTimerEx("AfterSpawnHos", 10000, false, "i", playerid);
    ApplyAnimationEx(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
    }
    return 1;
}



- Zack9764 - 13.02.2011

JaTochNietDan's suggestion didn't work. Let me try SkizzoTricks's.

Didn't work :S


Re: When a player types /acceptdeath they see ground? - JaTochNietDan - 13.02.2011

Okay, can you show me what you tried with my suggestion?


Re: When a player types /acceptdeath they see ground? - Calgon - 13.02.2011

Are you sure that -3451.3801, 475.9214, 58.0620 are valid X, Y and Z coordinates?


Re: When a player types /acceptdeath they see ground? - Zack9764 - 13.02.2011

Code:
if(strcmp(cmd, "/acceptdeath", true) == 0)
	{
	    if (IsDead[playerid] == 1)
	    {
	        SetTimerEx("ReloadPos",4000,false,"i",playerid);
	        new RandomWeth;
			RandomWeth = random(2);
	    	switch(RandomWeth)
	    	{
	            case 0:
	            {
	                SetPlayerVirtualWorld(playerid,1);
	       	    }
	            case 1:
	       	    {
	       	        SetPlayerVirtualWorld(playerid,2);
	            }
			}
			return 1;
		}
	}
and the reloadpos
Code:
forward ReloadPos(playerid);
public ReloadPos(playerid)
{
	new Float:X,Float:Y,Float:Z;
	GetPlayerPos(playerid, X, Y, Z);
   	DropWeapons(GetPlayerWeapon(playerid),GetPlayerAmmo(playerid),X,Y,Z,GetPlayerVirtualWorld(playerid),playerid);
    ResetPlayerWeaponsEx(playerid);
    SetPlayerToTeamColor(playerid);
    TogglePlayerControllable(playerid,false);
    SetPlayerHealthEx(playerid,1.0);
    SetPlayerPos(playerid, -3451.3801,475.9214,58.0620);
    SetPlayerInterior(playerid, 0);
    TogglePlayerControllable(playerid, 0);
    SetTimerEx("AfterSpawnHos", 10000, false, "i", playerid);
    ApplyAnimationEx(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
    GameTextForPlayer(playerid,"~w~~n~~n~~n~~n~~n~~n~~n~~n~~n~You need to rest now, please wait",8000,3);
    SetTimerEx("AfterSpawnHos", 10000, false, "i", playerid);
    ApplyAnimationEx(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
    Hospitalized[playerid] = 1;
    return 1;
}
And on yours Jatoch I did like,

Code:
if(strcmp(cmd, "/acceptdeath", true) == 0)
	{
	    if (IsDead[playerid] == 1)
	    {
     		new Float:X,Float:Y,Float:Z;
                GetPlayerPos(playerid, X, Y, Z);
DropWeapons(GetPlayerWeapon(playerid),GetPlayerAmmo(playerid),X,Y,Z,GetPlayerVirtualWorld(playerid),pla    yerid);
	        ResetPlayerWeaponsEx(playerid);
    	        SetPlayerToTeamColor(playerid);
	        TogglePlayerControllable(playerid,false);
	        SetPlayerHealthEx(playerid,1.0);
	        SetPlayerPos(playerid, -3451.3801,475.9214,58.0620);
                SetPlayerInterior(playerid,0);
	        TogglePlayerControllable(playerid, 0);
	        new RandomWeth;
		RandomWeth = random(2);
	    	switch(RandomWeth)
	    	{
	            case 0:
	            {
	                SetPlayerVirtualWorld(playerid,1);
                        SetPlayerInterior(playerid,0);
	       	    }
	            case 1:
	       	    {
	       	        SetPlayerVirtualWorld(playerid,2);
                        SetPlayerInterior(playerid,0);
	            }
		}
	        GameTextForPlayer(playerid,"~w~~n~~n~~n~~n~~n~~n~~n~~n~~n~You need to rest now, please wait",8000,3);
		    SetTimerEx("AfterSpawnHos", 10000, false, "i", playerid);
		    ApplyAnimationEx(playerid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
		    Hospitalized[playerid] = 1;
		    return 1;
		}
	}



Re: When a player types /acceptdeath they see ground? - JaTochNietDan - 13.02.2011

Well that's definitely not going to make a difference, since the inside of the hospital is not going to be interior 0. Interior 0 only contains the outside world. Like I said, you need to find the interior ID of the hospital, so, go into the hospital however you got in there before when it worked and type '/interior'. Then it will display the interior ID of the hospital, then use that ID in the SetPlayerInterior function.


Calgon - Zack9764 - 13.02.2011

Quote:
Originally Posted by Calgon
View Post
Are you sure that -3451.3801, 475.9214, 58.0620 are valid X, Y and Z coordinates?
Yes, because originally when you die it sends you straight there and works fine. Now I want you to be able to respawn in your location.

Quote:
Originally Posted by JaTochNietDan
View Post
Well that's definitely not going to make a difference, since the inside of the hospital is not going to be interior 0. Interior 0 only contains the outside world. Like I said, you need to find the interior ID of the hospital, so, go into the hospital however you got in there before when it worked and type '/interior'. Then it will display the interior ID of the hospital, then use that ID in the SetPlayerInterior function.
It's a hospital that's 100% mapped. So the interior is 0.


Re: When a player types /acceptdeath they see ground? - JaTochNietDan - 13.02.2011

Quote:
Originally Posted by Zack9764
View Post
Yes, because originally when you die it sends you straight there and works fine. Now I want you to be able to respawn in your location.



It's a hospital that's 100% mapped. So the interior is 0.
You should've mentioned that in your original post. So what the actual problem is, is that the objects aren't being loaded? That's a completely different problem, are you using an object streamer?