/spawn doesn't load
#1

HI guys I need your help. I have here spawn command which save/load spawn point. It works nice. But the problem after I get disconnect and reconnects again then in spawn it doesn't load the last time I used the command /spawn.. It was like its not triggering the save to load on player connect or on player spawn? what you think?

Код:
CMD:spawn(playerid,params[])
{
	GetPlayerPos( playerid, PosX[ playerid ], PosY[ playerid ], PosZ[ playerid ] );
	GetPlayerFacingAngle( playerid, Angle[ playerid ] );
	GetPlayerInterior (playerid);
 	GetPlayerVirtualWorld (playerid);
	GameTextForPlayer(playerid,"~y~Spawn Point ~n~~g~Saved",2000,3);
	return 1;
}
Код:
 INI_WriteFloat( ACCOUNT, "PositionX", PosX[ playerid ] );
	INI_WriteFloat( ACCOUNT, "PositionY", PosY[ playerid ] );
	INI_WriteFloat( ACCOUNT, "PositionZ", PosZ[ playerid ] );
	INI_WriteFloat( ACCOUNT, "Angle", Angle[ playerid ] );
Код:
public OnPlayerDisconnect(playerid, reason)
{

    GetPlayerPos( playerid, PosX[ playerid ], PosY[ playerid ], PosZ[ playerid ] );
    GetPlayerFacingAngle( playerid, Angle[ playerid ] );
Код:
public OnPlayerSpawn(playerid)
{

	if ( PosX[ playerid ] != 0 && PosY[ playerid ] != 0 && PosZ[ playerid ] != 0 )
    {
        SetPlayerPos( playerid, PosX[ playerid ], PosY[ playerid ], PosZ[ playerid ] );
        SetPlayerFacingAngle( playerid, Angle[ playerid ] );
        SetPlayerInterior( playerid, Interior[ playerid ] );
        SetPlayerVirtualWorld( playerid, VirtualWorld[ playerid ] );
        SetCameraBehindPlayer(playerid);
    }
    else
    {
   		new Random = random(sizeof(RandomSpawns));
    	SetPlayerPos(playerid, RandomSpawns[Random][0], RandomSpawns[Random][1], RandomSpawns[Random][2]);
        // set the position for those who has not saved
    }
return 1;
}
Reply


Messages In This Thread
/spawn doesn't load - by kbalor - 09.10.2013, 19:49
Re: /spawn doesn't load - by xVIP3Rx - 09.10.2013, 19:58
Re: /spawn doesn't load - by Konstantinos - 09.10.2013, 20:02
Re: /spawn doesn't load - by xVIP3Rx - 09.10.2013, 20:05
Re: /spawn doesn't load - by kbalor - 09.10.2013, 20:06
Re: /spawn doesn't load - by xVIP3Rx - 09.10.2013, 20:07
Re: /spawn doesn't load - by Konstantinos - 09.10.2013, 20:14
Re: /spawn doesn't load - by xVIP3Rx - 09.10.2013, 20:15
Re: /spawn doesn't load - by kbalor - 09.10.2013, 20:20
Re: /spawn doesn't load - by xVIP3Rx - 09.10.2013, 20:23

Forum Jump:


Users browsing this thread: 2 Guest(s)