A little /v park edit - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: A little /v park edit (
/showthread.php?tid=387208)
A little /v park edit -
Shannkz - 23.10.2012
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?
Re: A little /v park edit -
Youice - 23.10.2012
I found no issues, mind showings us "
SaveCar" function?
Re: A little /v park edit -
Shannkz - 23.10.2012
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]);
}
}
Re: A little /v park edit -
Shannkz - 23.10.2012
So anyone?
Re: A little /v park edit -
Shannkz - 24.10.2012
BUMP?
Please?