20.04.2017, 10:00
Hello everyone... There a problem... i need OnPlayerConnect To Server Load To him vehicles owned and in OnPlayerDisconnect Too if A Player leave server Remove His vehicles From Server.
And after connecting again Load To Him his Vehicles...
And after connecting again Load To Him his Vehicles...
PHP код:
public OnPlayerConnect(playerid)
{
SetPVarInt(playerid, "xv_teklif_id", INVALID_PLAYER_ID);
SetPVarInt(playerid, "xv_teklif_gonderen", INVALID_PLAYER_ID);
LoadxVehicleKeys(playerid);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
if(GetPVarInt(playerid, "xv_teklif_gonderen") != INVALID_PLAYER_ID)
{
new gonderen = GetPVarInt(playerid, "xv_teklif_gonderen");
KillTimer(offerTimer[playerid]);
SetPVarInt(gonderen, "xv_teklif_id", INVALID_PLAYER_ID);
SendClientMessage(gonderen, -1, "{FF0000}[ERROR]:- {DCDC22}Your vehicle offer has cancelled because of the player that you offered has disconnected.");
}
if(GetPVarInt(playerid, "xv_teklif_id") != INVALID_PLAYER_ID)
{
new alan = GetPVarInt(playerid, "xv_teklif_id");
SetPVarInt(alan, "xv_teklif_gonderen", INVALID_PLAYER_ID);
DeletePVar(alan, "xv_teklif_xid");
DeletePVar(alan, "xv_teklif_fiyat");
KillTimer(offerTimer[alan]);
SendClientMessage(alan, -1, "{FF0000}[ERROR]:- {DCDC22}The offer has cancelled because of the player that make the offer has disconnected.");
}
if(IsPlayerInAnyVehicle(playerid))
{
new xid = xVeh[GetPlayerVehicleID(playerid)], Float:xvHP;
GetVehicleHealth(GetPlayerVehicleID(playerid), xvHP);
if(xid != 0 && xVehicle[xid][xv_HizliPark] == 1 && !IsVehicleFlipped(GetPlayerVehicleID(playerid)) && xvHP > 300)
{
GetVehiclePos(GetPlayerVehicleID(playerid), xVehicle[xid][xv_Pos][0], xVehicle[xid][xv_Pos][1], xVehicle[xid][xv_Pos][2]);
GetVehicleZAngle(GetPlayerVehicleID(playerid), xVehicle[xid][xv_Pos][3]);
SavexVehicle(xid);
}
}
return 1;
}