make /park save mods
#1

PHP код:
CMD:park(playeridparams[])
{
    if(
PlayerInfo[playerid][pVehicleKeysFrom] != INVALID_PLAYER_ID)
    {
        new 
ownerid PlayerInfo[playerid][pVehicleKeysFrom];
        if(
IsPlayerConnected(ownerid))
        {
            new 
PlayerInfo[playerid][pVehicleKeys];
            if(
IsPlayerInVehicle(playeridPlayerVehicleInfo[ownerid][d][pvId]))
            {
                if(
GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessageEx(playeridCOLOR_GREY"You must be in the driver seat.");
                new 
Float:xFloat:yFloat:zFloat:angleFloat:health;
                
GetVehicleHealth(PlayerVehicleInfo[ownerid][d][pvId], health);
                if(
health 800) return SendClientMessageEx(playeridCOLOR_GREY" Your vehicle is too damaged to park it.");
                if(
PlayerInfo[playerid][pLockCar] == GetPlayerVehicleID(playerid)) PlayerInfo[playerid][pLockCar] = INVALID_VEHICLE_ID;
                if(
IsARC(GetPlayerVehicleID(playerid))) // RC Vehicles
                
{
                    new 
Float:vehPos[3];
                    
GetVehiclePos(GetPlayerVehicleID(playerid),vehPos[0], vehPos[1], vehPos[2]);
                    
SetPlayerPos(playerid,vehPos[0], vehPos[1]+0.5vehPos[2]+0.5);
                }
                
GetVehiclePos(PlayerVehicleInfo[ownerid][d][pvId], xyz);
                
GetVehicleZAngle(PlayerVehicleInfo[ownerid][d][pvId], angle);
                
SurfingCheck(GetPlayerVehicleID(playerid));
                
UpdatePlayerVehicleParkPosition(owneriddxyzanglehealth);
                
PutPlayerInVehicle(playeridGetPlayerVehicleID(playerid), 0);
                 
SetPlayerArmedWeapon(playerid0);
                new 
string[29 + (MAX_PLAYER_NAME 2)];
                
format(stringsizeof(string), "* %s has parked %s's vehicle."GetPlayerNameEx(playerid), GetPlayerNameEx(ownerid));
                
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                return 
1;
            }
        }
    }
    for(new 
MAX_PLAYERVEHICLESd++)
    {
        if(
IsPlayerInVehicle(playeridPlayerVehicleInfo[playerid][d][pvId]))
        {
            new 
Float:xFloat:yFloat:zFloat:angleFloat:health;
            
GetVehicleHealth(PlayerVehicleInfo[playerid][d][pvId], health);
            if(
GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessageEx(playeridCOLOR_GREY"You must be in the driver seat.");
            if(
health 800) return SendClientMessageEx(playeridCOLOR_GREY" Your vehicle is too damaged to park it.");
            if(
PlayerInfo[playerid][pLockCar] == GetPlayerVehicleID(playerid)) PlayerInfo[playerid][pLockCar] = INVALID_VEHICLE_ID;
            
GetVehiclePos(PlayerVehicleInfo[playerid][d][pvId], xyz);
            
GetVehicleZAngle(PlayerVehicleInfo[playerid][d][pvId], angle);
            
SurfingCheck(GetPlayerVehicleID(playerid));
            
UpdatePlayerVehicleParkPosition(playeriddxyzanglehealth);
            
PutPlayerInVehicle(playeridPlayerVehicleInfo[playerid][d][pvId], 0);
            
SetPlayerArmedWeapon(playerid0);
            new 
string[30 + (MAX_PLAYER_NAME 2)];
            
format(stringsizeof(string), "* %s has parked their vehicle."GetPlayerNameEx(playerid));
            
ProxDetector(30.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            return 
1;
        }
    }
    
SendClientMessageEx(playeridCOLOR_GREY"You need to be inside a vehicle that you own.");
    return 
1;

Reply
#2

In all that bunch of code there are so many unneeded checks/script.

Anyway, u didn't say what u want to save them with

pawn Код:
new VehicleCmp[MAX_VEHICLES][14];
stock SaveVehicleComponent(vehid)
{
 for(new s=0; s < 13; s++;
    {
        VehicleCmp[vehid][s] = GetVehicleComponentInSlot(vehid,s);
    }
}
Reply
#3

transfender mods etc
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)