Quantcast
Channel: SA-MP Forums
Viewing all articles
Browse latest Browse all 18226

LoadVehicles heelp

$
0
0
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...


PHP Code:

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(playeridreason)
{
    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 != && xVehicle[xid][xv_HizliPark] == && !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;



Viewing all articles
Browse latest Browse all 18226

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>