Sync Problem -
(_AcE_) - 25.07.2012
pawn Код:
forward Sync(playerid);
new Float:FaceAngle[MAX_PLAYERS];
new Float:PlayerHPP[MAX_PLAYERS];
new VehicleIDD[MAX_PLAYERS];
new ammoo[13][MAX_PLAYERS];
new Float:APP[MAX_PLAYERS];
new vehicledd[MAX_PLAYERS];
new interior[MAX_PLAYERS];
new skinneg[MAX_PLAYERS];
new gun[13][MAX_PLAYERS];
new virt[MAX_PLAYERS];
new Float:xx, Float:yy, Float:zz;
pawn Код:
dcmd_sync(playerid, params[])
{
#pragma unused params
if(GetPlayerState(playerid) == 9|| GetPlayerState(playerid) == 5 || GetPlayerState(playerid) == 6 ||GetPlayerState(playerid) == 4|| GetPlayerState(playerid) == 0)
{
SendClientMessage(playerid,COLOR_ERROR,"ERROR: The synchronization failed, please try again.");
PlayerPlaySound(playerid, 1053, 0.0, 0.0, 0.0);
return 1;
}
SyncPlayer(playerid);
SendClientMessage(playerid,COLOR_MESSAGE,"Synchronization was made successfully!");
return 1;
}
pawn Код:
forward SyncPlayer(playerid);
public SyncPlayer(playerid)
{
virt[playerid] = GetPlayerVirtualWorld(playerid);
interior[playerid] = GetPlayerInterior(playerid);
skinneg[playerid] = GetPlayerSkin(playerid);
GetPlayerArmour(playerid,APP[playerid]);
GetPlayerHealth(playerid,PlayerHPP[playerid]);
GetPlayerFacingAngle(playerid,FaceAngle[playerid]);
GetPlayerPos(playerid,xx,yy,zz);
GetPlayerWeaponData(playerid,1,gun[1][playerid],ammoo[1][playerid]);
GetPlayerWeaponData(playerid,2,gun[2][playerid],ammoo[2][playerid]);
GetPlayerWeaponData(playerid,3,gun[3][playerid],ammoo[3][playerid]);
GetPlayerWeaponData(playerid,4,gun[4][playerid],ammoo[4][playerid]);
GetPlayerWeaponData(playerid,5,gun[5][playerid],ammoo[5][playerid]);
GetPlayerWeaponData(playerid,6,gun[6][playerid],ammoo[6][playerid]);
GetPlayerWeaponData(playerid,7,gun[7][playerid],ammoo[7][playerid]);
GetPlayerWeaponData(playerid,8,gun[8][playerid],ammoo[8][playerid]);
GetPlayerWeaponData(playerid,9,gun[9][playerid],ammoo[9][playerid]);
GetPlayerWeaponData(playerid,10,gun[10][playerid],ammoo[10][playerid]);
GetPlayerWeaponData(playerid,11,gun[11][playerid],ammoo[11][playerid]);
GetPlayerWeaponData(playerid,12,gun[12][playerid],ammoo[12][playerid]);
if(IsPlayerInAnyVehicle(playerid))
{
vehicledd[playerid] = 1;
VehicleIDD[playerid] = GetPlayerVehicleID(playerid);
}
SpawnPlayer(playerid);
SetTimer("Sync", 500, false);
return 1;
}
pawn Код:
public Sync(playerid)
{
SetPlayerPos(playerid,xx,yy,zz);
SetPlayerFacingAngle(playerid,FaceAngle[playerid]);
SetPlayerHealth(playerid,PlayerHPP[playerid]);
SetPlayerVirtualWorld(playerid,virt[playerid]);
SetPlayerInterior(playerid,interior[playerid]);
SetPlayerSkin(playerid,skinneg[playerid]);
SetPlayerArmour(playerid,APP[playerid]);
ResetPlayerWeapons(playerid);
GivePlayerWeapon(playerid,gun[1][playerid],ammoo[1][playerid]);
GivePlayerWeapon(playerid,gun[2][playerid],ammoo[2][playerid]);
GivePlayerWeapon(playerid,gun[3][playerid],ammoo[3][playerid]);
GivePlayerWeapon(playerid,gun[4][playerid],ammoo[4][playerid]);
GivePlayerWeapon(playerid,gun[5][playerid],ammoo[5][playerid]);
GivePlayerWeapon(playerid,gun[6][playerid],ammoo[6][playerid]);
GivePlayerWeapon(playerid,gun[7][playerid],ammoo[7][playerid]);
GivePlayerWeapon(playerid,gun[8][playerid],ammoo[8][playerid]);
GivePlayerWeapon(playerid,gun[9][playerid],ammoo[9][playerid]);
GivePlayerWeapon(playerid,gun[10][playerid],ammoo[10][playerid]);
GivePlayerWeapon(playerid,gun[11][playerid],ammoo[11][playerid]);
GivePlayerWeapon(playerid,gun[12][playerid],ammoo[12][playerid]);
if(vehicledd[playerid] == 1)
{
PutPlayerInVehicle(playerid,VehicleIDD[playerid],1);
vehicledd[playerid] = 0;
}
}
When I was testing this with my friend, we noticed if I type /sync first, it will work correctly, but when he tried to use /s it would respawn him to a spawn location, and set me to his position where he synced.
Re: Sync Problem -
[MM]RoXoR[FS] - 25.07.2012
pawn Код:
//Change SetTimer("Sync", 500, false); to
SetTimerEx("Sync", 500, false,"i",playerid);