A little /v park edit
#1

pawn Код:
else if(strcmp(x_nr,"park",true) == 0)
                {
                    if(PlayerInfo[playerid][pCar] == 9999)
                    {
                        SendClientMessage(playerid, COLOR_GREY, "You don't own a car.");
                        return 1;
                    }
                    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
                    {
                        new carid = GetPlayerVehicleID(playerid);
                        if(carid == PlayerInfo[playerid][pCar])
                        {
                            new Float:x,Float:y,Float:z;
                            new Float:a;
                            GetPlayerName(playerid, playername, sizeof(playername));
                            GetVehiclePos(carid, x, y, z);
                            GetVehicleZAngle(carid, a);
                            CarInfo[carid][cLocationx] = x;
                            CarInfo[carid][cLocationy] = y;
                            CarInfo[carid][cLocationz] = z;
                            CarInfo[carid][cAngle] = a;
                            format(string, sizeof(string), "You have saved your vehicle at the position %f.01, %f.01, %f.01, Remember it, it will respawn here!",x,y,z);
                            SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
                            SaveCar(carid);
                        }
                        else
                        {
                            SendClientMessage(playerid, COLOR_GREY, "You'r not in your car.");
                            return 1;
                        }
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GREY, "You'r not in a car.");
                        return 1;
                    }
                    return 1;
                }
I got this command.
But this command saves the car at the wanted location after a server restart.
How to make it save without a server restart?
Reply
#2

I found no issues, mind showings us "SaveCar" function?
Reply
#3

pawn Код:
forward SaveCar(idx);
public SaveCar(idx)
{
    new file[128];
    format(file, sizeof(file),"cars/%d.ini",idx);
    if(dini_Exists(file))
    {
        dini_IntSet(file,"Model",CarInfo[idx][cModel]);
        dini_IntSet(file,"ID",CarInfo[idx][cID]);
        dini_FloatSet(file,"Location_X",CarInfo[idx][cLocationx]);
        dini_FloatSet(file,"Location_Y",CarInfo[idx][cLocationy]);
        dini_FloatSet(file,"Location_Z",CarInfo[idx][cLocationz]);
        dini_FloatSet(file,"Angle",CarInfo[idx][cAngle]);
        dini_IntSet(file,"Color_1",CarInfo[idx][cColorOne]);
        dini_IntSet(file,"Color_2",CarInfo[idx][cColorTwo]);
        dini_Set(file,"Owner",CarInfo[idx][cOwner]);
        dini_IntSet(file,"Owned",CarInfo[idx][cOwned]);
    }
}
Reply
#4

So anyone?
Reply
#5

BUMP? Please?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)