[HELP] Newb spawn and when you logged out.
#1

Okay Im new to coding but I have caught on really quickly. Anyway,
Im using Fort Carson Roleplay and you can choose quite alot of places to spawn.
Well I want it so when you just joined you spawn at Cityhall or something and when you crash or log out.
you go back to the position you was at. Can someone help me

This is the code (I think):
Код:
    if(PlayerInfo[playerid][pCrashed] >= 1 && PlayerInfo[playerid][pCrashed] <= 2)
	{
        SetPlayerToTeamColor(playerid);
        SetPlayerInterior(playerid,PlayerInfo[playerid][pInt]);
	    DOO_SetPlayerPos(playerid, PlayerInfo[playerid][pPos_x], PlayerInfo[playerid][pPos_y], PlayerInfo[playerid][pPos_z] + 1);
   	    SetPlayerVirtualWorld(playerid,PlayerInfo[playerid][pWorld]);
   	    if(PlayerInfo[playerid][pCrashHealth] > 10.0)
   	    {
		   SetPlayerHealthEx(playerid,PlayerInfo[playerid][pCrashHealth]);
        }
        else
        {
           SetPlayerHealthEx(playerid,10.0);
        }
        if(PlayerInfo[playerid][pPos_x] == 0.0 && PlayerInfo[playerid][pPos_y] == 0.0 && PlayerInfo[playerid][pPos_z] == 0.0)
        {
            DOO_SetPlayerPos(playerid,-88.2428,1378.3292,10.2734);
            SetPlayerFacingAngle(playerid, 0);
            SetPlayerInterior(playerid,0);
        }
    	SetPlayerArmourEx(playerid,PlayerInfo[playerid][pCrashArmour]);
        SetTimerEx("UnsetCrash", 20000, false, "i", playerid);
        SetPlayerWeapons(playerid);
    	return 1;
	}
	if(PlayerInfo[playerid][pCrashed] > 2)
	{
        PlayerInfo[playerid][pCrashed] = 0;
	}
	if(type == 1)
	{
	    TogglePlayerSpectating(playerid,1);
	    PlayerInfo2[UsingSpawnBar][playerid] = 1;
	    TextDrawHideForPlayer(playerid, E1);
	    TextDrawShowForPlayer(playerid, NewbieDraw3);
	    TextDrawShowForPlayer(playerid, NewbieDraw1[playerid]);
	    TextDrawShowForPlayer(playerid, NewbieDraw2[playerid]);
	    SpawnSpots(playerid);
	    SetTimerEx("SpawnBarFix", 2000, false, "i", playerid);
	    SendClientMessage(playerid,COLOR_WHITE," ");
	    SendClientMessage(playerid,COLOR_WHITE,"Press Your fire key to spawn at that location, and sprint key to change location.");
		return 1;
	}
	if(house != 255)
	{
        SetPlayerToTeamColor(playerid);
	    SetPlayerInterior(playerid,HouseInfo[house][hInt]);
	    SetPlayerVirtualWorld(playerid,house+100);
	    DOO_SetPlayerPos(playerid, HouseInfo[house][hExitx], HouseInfo[house][hExity],HouseInfo[house][hExitz]); // Warp the player
	    PlayerInfo[playerid][pLocal] = house;
	    PlayerInfo[playerid][pInt] = HouseInfo[house][hInt];
	    PlayerInfo2[HouseEntered][playerid] = house;
	    return 1;
	}
	else if (PlayerInfo[playerid][pMember] == 6)//Police Force spawn
	{
	    SetPlayerToTeamColor(playerid);
		rand = random(sizeof(gCopPlayerSpawns));
		DOO_SetPlayerPos(playerid, gCopPlayerSpawns[rand][0], gCopPlayerSpawns[rand][1], gCopPlayerSpawns[rand][2]); // Warp the player
		SetPlayerFacingAngle(playerid, 270.0);
		SetPlayerInterior(playerid,0);
		PlayerInfo[playerid][pInt] = 0;
		return 1;
    }
    else if (PlayerInfo[playerid][pMember] == 2)//FBI spawn
	{
	    SetPlayerToTeamColor(playerid);
	    SetPlayerInterior(playerid,3);
	    DOO_SetPlayerPos(playerid, 299.7097,183.1322,1007.1719);
	    SetPlayerFacingAngle(playerid, 90);
	    SetPlayerVirtualWorld(playerid,1);
        PlayerInfo[playerid][pInt] = 3;
        PlayerInfo2[IntEntered][playerid] = 14;
	    return 1;
    }
    else if(PlayerInfo[playerid][pMember] == 3)//Mayor/Gov spawn
	{
        SetPlayerToTeamColor(playerid);
        SetPlayerInterior(playerid, 3);
        DOO_SetPlayerPos(playerid, 356.2998,151.9914,1025.7891);
        PlayerInfo[playerid][pInt] = 3;
        PlayerInfo2[IntEntered][playerid] = 5;
        return 1;
	}
	else if (PlayerInfo[playerid][pMember] == 4)//Fire/Ambulance spawn
	{
        SetPlayerToTeamColor(playerid);
        DOO_SetPlayerPos(playerid, -3429.0164,475.4126,57.6132);
        SetPlayerFacingAngle(playerid, 0);
        SetPlayerVirtualWorld(playerid,0);
        PlayerInfo2[IntEntered][playerid] = 2;
        return 1;
    }
    else if (PlayerInfo[playerid][pMember] >= 7 && FamilyInfo[PlayerInfo[playerid][pMember]][FamilyInterior] != 0) // Factions
	{
		new fam = PlayerInfo[playerid][pMember];
        SetPlayerToTeamColor(playerid);
        SetPlayerVirtualWorld(playerid,fam);
        switch (FamilyInfo[fam][FamilyInterior])
	    {
		    case 1:
		    {
		        SetPlayerInterior(playerid,5);
                DOO_SetPlayerPos(playerid, 309.9930,1122.5713,1083.8828);
		    }
		    case 2:
		    {
		        SetPlayerInterior(playerid,2);
                DOO_SetPlayerPos(playerid, 2465.8018,-1698.3330,1013.5078);
		    }
		    case 3:
		    {
		        SetPlayerInterior(playerid,3);
                DOO_SetPlayerPos(playerid, 2496.0498,-1694.3333,1014.7422);
		    }
		    case 4:
		    {
		        SetPlayerInterior(playerid,8);
                DOO_SetPlayerPos(playerid, 2807.6926,-1171.0026,1025.5703);
		    }
		    case 5:
		    {
                SetPlayerInterior(playerid,5);
                DOO_SetPlayerPos(playerid, 2347.8057,-1181.1316,1027.9766);
		    }
		    case 6:
		    {
		        SetPlayerInterior(playerid,1);
                DOO_SetPlayerPos(playerid, 2529.6406,-1679.5159,1015.4986);
		    }
	    }
        return 1;
    }
    else // Nooby Spawn
    {
		SetPlayerToTeamColor(playerid);
		DOO_SetPlayerPos(playerid, -88.2428,1378.3292,10.2734);
        SetPlayerFacingAngle(playerid, 0);
        SetPlayerInterior(playerid,0);
        PlayerInfo[playerid][pInt] = 0;
	}
    return 1;
}
Reply
#2

sorry for the bump but I really need this done :/
Reply
#3

You need to store the last known co-ordinates of the player in the playerfile under OnPlayerDisconnect. Then when they spawn, you need to load those co-ords and set their position there.
Reply
#4

Quote:
Originally Posted by Ensconce
Посмотреть сообщение
You need to store the last known co-ordinates of the player in the playerfile under OnPlayerDisconnect. Then when they spawn, you need to load those co-ords and set their position there.
Like I said im sorta new to coding .pwn files and I need the codes, I know where to put them.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)