20.02.2014, 19:22
Hey, I tried to make this simple save/load position system, so that when a player disconnects, his pos is saved to his file and when he connects back to the server, he is teleported to those coords. They coords are saved properly but they won't load, instead it'll teleport the player back to his faction's HQ (if he died or got respawned).
Here's the code:
Also JustConnected is set to 1 when a player connects if he's registered.
Here's the code:
pawn Код:
if(JustConnected[playerid] == 1 && pInfo[playerid][Jailed] != 1) // If the player just connected and he's not jailed
{
SetPlayerPos(playerid,pInfo[playerid][posX],pInfo[playerid][posY],pInfo[playerid][posZ]);
SetPlayerInterior(playerid,pInfo[playerid][Interior]);
SetPlayerVirtualWorld(playerid,pInfo[playerid][VirtualWorld]);
JustConnected[playerid]=0;
if(pInfo[playerid][Faction] == 1)
{
GivePlayerWeapon(playerid,3,1);
switch(pInfo[playerid][Clothes])
{
case 1: SetPlayerSkin(playerid,280);
case 2: SetPlayerSkin(playerid,281);
case 3: SetPlayerSkin(playerid,284);
case 4: SetPlayerSkin(playerid,285);
case 5: SetPlayerSkin(playerid,282);
case 6: SetPlayerSkin(playerid,265);
}
SetPlayerColor(playerid,COLOR_BLUE);
}
else if(pInfo[playerid][Faction] == 3)
{
SetPlayerColor(playerid,COLOR_ORANGE);
switch(pInfo[playerid][Clothes])
{
case 1: SetPlayerSkin(playerid,197);
case 2: SetPlayerSkin(playerid,188);
case 3: SetPlayerSkin(playerid,187);
case 4: SetPlayerSkin(playerid,228);
case 5: SetPlayerSkin(playerid,240);
case 6: SetPlayerSkin(playerid,227);
}
}
}
else if(pInfo[playerid][Faction] == 1) // ... if he died/respawned he'll teleport to his faction's HQ