Help need!
#1

How to make a system that, when a player buy a car, His will will be at /park position, Once he desconnect, His vehicle will not disappear and also , that car will be at that place he parked before /q . Even when he connect again, His Vehicle will not spawn . and also, he can go that last parked place to take his car.
I have tried in many ways, but failed. So, I am requesting to expert to help me. Please help me
Reply
#2

Which part of your "attempt" didn't work, let us help you not make it for you..
Reply
#3

PHP код:
LoadPlayerVehicles(playerid);

UnloadPlayerVeHicles(playerid)

stock LoadPlayerVehicles(playerid)
{
    new 
playername[MAX_PLAYER_NAME];
    
GetPlayerName(playeridplayernamesizeof(playername));
    
printf(" Loading %s's vehicles."playername);
    for(new 
0MAX_PLAYERVEHICLESv++)
    {
        if(
PlayerVehicleInfo[playerid][v][pvModelId] != && PlayerVehicleInfo[playerid][v][pvImpounded] == 0)
        {
            
PlayerCars++;
            new 
carcreated AddStaticVehicleEx(PlayerVehicleInfo[playerid][v][pvModelId], PlayerVehicleInfo[playerid][v][pvPosX], PlayerVehicleInfo[playerid][v][pvPosY], PlayerVehicleInfo[playerid][v][pvPosZ], PlayerVehicleInfo[playerid][v][pvPosAngle],PlayerVehicleInfo[playerid][v][pvColor1], PlayerVehicleInfo[playerid][v][pvColor2], -1);
            
PlayerVehicleInfo[playerid][v][pvId] = carcreated;
            
Gas[carcreated] = PlayerVehicleInfo[playerid][v][pvFuel];
            if(!
isnull(PlayerVehicleInfo[playerid][v][pvPlate]))
            {
                
SetVehicleNumberPlate(carcreatedPlayerVehicleInfo[playerid][v][pvPlate]);
            }
            else
            {
                    new 
string[128], randletter[2];
                    
randletter[0] = lAlphabet[random(sizeof(lAlphabet))][0];
                    
randletter[1] = lAlphabet[random(sizeof(lAlphabet))][0];
                    
format(stringsizeof(string), "%s%s%d"randletter[0], randletter[1], carcreated);
                    
SetVehicleNumberPlate(carcreatedstring);
            }
            
//SetVehicleNumberPlate(carcreated, PlayerVehicleInfo[playerid][v][pvNumberPlate]);
            
if(PlayerVehicleInfo[playerid][v][pvLocked] == && !IsABike(PlayerVehicleInfo[playerid][v][pvId])) LockPlayerVehicle(playeridPlayerVehicleInfo[playerid][v][pvId], PlayerVehicleInfo[playerid][v][pvLock]);
        }
        else if(
PlayerVehicleInfo[playerid][v][pvModelId] == && PlayerVehicleInfo[playerid][v][pvImpounded] != 0)
            
PlayerVehicleInfo[playerid][v][pvImpounded] = 0;
    }
    
LoadAllPlayerVehicleMods(playerid);
}

stock UnloadPlayerVehicles(playerid)
{
    new 
playername[MAX_PLAYER_NAME];
    
GetPlayerName(playeridplayernamesizeof(playername));
    
printf(" Unloading %s's vehicles."playername);
    for(new 
0MAX_PLAYERVEHICLESv++)
    {
        if(
PlayerVehicleInfo[playerid][v][pvId] != INVALID_PLAYER_VEHICLE_ID && PlayerVehicleInfo[playerid][v][pvImpounded] == 0)
        {
           
// new Float:x, Float:y, Float:z, Float:angle;
          //  GetVehiclePos(PlayerVehicleInfo[playerid][v][pvId], x, y, z);
            //GetVehicleZAngle(PlayerVehicleInfo[playerid][v][pvId], angle);
            //UpdatePlayerVehicleParkPosition(playerid, v, x, y, z, angle);
            
PlayerCars--;
            if(
LockStatus[PlayerVehicleInfo[playerid][v][pvId]] != 0LockStatus[PlayerVehicleInfo[playerid][v][pvId]] = 0;
            
UpdatePlayerVehicleMods(playeridv);
            
DestroyVehicle(PlayerVehicleInfo[playerid][v][pvId]);
            
Gas[PlayerVehicleInfo[playerid][v][pvId]] = 100.0;
            
PlayerVehicleInfo[playerid][v][pvId] = INVALID_PLAYER_VEHICLE_ID;
            if(
PlayerVehicleInfo[playerid][v][pvAllowedPlayerId] != INVALID_PLAYER_ID)
            {
                
PlayerInfo[PlayerVehicleInfo[playerid][v][pvAllowedPlayerId]][pVehicleKeys] = INVALID_PLAYER_VEHICLE_ID;
                
PlayerInfo[PlayerVehicleInfo[playerid][v][pvAllowedPlayerId]][pVehicleKeysFrom] = INVALID_PLAYER_ID;
                
PlayerVehicleInfo[playerid][v][pvAllowedPlayerId] = INVALID_PLAYER_ID;
            }
        }
    }
}

stock UpdatePlayerVehicleParkPosition(playeridplayervehicleidFloat:newxFloat:newyFloat:newzFloat:newangleFloat:health)
{
    new 
playername[MAX_PLAYER_NAME];
    
GetPlayerName(playeridplayernamesizeof(playername));
    if(
PlayerVehicleInfo[playerid][playervehicleid][pvId] != INVALID_PLAYER_VEHICLE_ID)
    {
        if(!
isnull(PlayerVehicleInfo[playerid][playervehicleid][pvPlate])) {
            
SetVehicleNumberPlate(playervehicleidPlayerVehicleInfo[playerid][playervehicleid][pvPlate]);
        }
         new 
Float:oldxFloat:oldyFloat:oldzFloatoldfuel;
         
oldx PlayerVehicleInfo[playerid][playervehicleid][pvPosX];
         
oldy PlayerVehicleInfo[playerid][playervehicleid][pvPosY];
         
oldz PlayerVehicleInfo[playerid][playervehicleid][pvPosZ];
         if(
oldx == newx && oldy == newy && oldz == newz) return 0;
         
PlayerVehicleInfo[playerid][playervehicleid][pvPosX] = newx;
         
PlayerVehicleInfo[playerid][playervehicleid][pvPosY] = newy;
         
PlayerVehicleInfo[playerid][playervehicleid][pvPosZ] = newz;
         
PlayerVehicleInfo[playerid][playervehicleid][pvPosAngle] = newangle;
         
oldfuel Gas[PlayerVehicleInfo[playerid][playervehicleid][pvId]];
         
Gas[PlayerVehicleInfo[playerid][playervehicleid][pvId]] = 100.0;
         for(new 
c=0c<12c++) {
             
RemoveVehicleComponent(playervehicleidc);
         }
         
UpdatePlayerVehicleMods(playeridplayervehicleid);
         
DestroyVehicle(PlayerVehicleInfo[playerid][playervehicleid][pvId]);
         new 
carcreated AddStaticVehicleEx(PlayerVehicleInfo[playerid][playervehicleid][pvModelId], PlayerVehicleInfo[playerid][playervehicleid][pvPosX], PlayerVehicleInfo[playerid][playervehicleid][pvPosY], PlayerVehicleInfo[playerid][playervehicleid][pvPosZ],
         
PlayerVehicleInfo[playerid][playervehicleid][pvPosAngle],PlayerVehicleInfo[playerid][playervehicleid][pvColor1], PlayerVehicleInfo[playerid][playervehicleid][pvColor2], -1);
         
PlayerVehicleInfo[playerid][playervehicleid][pvId] = carcreated;
         
Gas[carcreated] = oldfuel;
         
//SetVehicleNumberPlate(carcreated, PlayerVehicleInfo[playerid][playervehicleid][pvNumberPlate]);
         
SetVehicleHealth(carcreatedhealth);
         if(
PlayerVehicleInfo[playerid][playervehicleid][pvLocked] == 1LockPlayerVehicle(playeridPlayerVehicleInfo[playerid][playervehicleid][pvId], PlayerVehicleInfo[playerid][playervehicleid][pvLock]);
            
LoadPlayerVehicleMods(playeridplayervehicleid);
         return 
1;
    }
    return 
0;

I have disabled this two Load and unload for checking. Failed . I have also use UpdatePlayerVehicleParkPosition for try to place the vehicle in the last parked place
Reply
#4

Need help ASAP
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)