Car Destroy - 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: Car Destroy (
/showthread.php?tid=372747)
Car Destroy -
UnknownGamer - 28.08.2012
Код:
new currentveh;
new currentveh2;
currentveh = PlayerInfo[playerid][pPcarkey];
currentveh2 = PlayerInfo[playerid][pPcarkey2];
DestroyVehicle(currentveh);
DestroyVehicle(currentveh2);
so i added that in, Onplayerdisconnect, how would I make it re-spawn when they log back in, I tried the following under Onplayerspawn but didnt work?
Код:
// CAR RELOAD COMMAND //
LoadCar();
new scurrentveh;
new scurrentveh2;
scurrentveh = PlayerInfo[playerid][pPcarkey];
scurrentveh2 = PlayerInfo[playerid][pPcarkey2];
CreateVehicle(CarInfo[scurrentveh][cModel],CarInfo[scurrentveh][cLocationx],CarInfo[scurrentveh][cLocationy],CarInfo[scurrentveh][cLocationz]+1.0,CarInfo[scurrentveh][cAngle],CarInfo[scurrentveh][cColorOne],CarInfo[scurrentveh][cColorTwo],60000);
CreateVehicle(CarInfo[scurrentveh2][cModel],CarInfo[scurrentveh2][cLocationx],CarInfo[scurrentveh2][cLocationy],CarInfo[scurrentveh2][cLocationz]+1.0,CarInfo[scurrentveh2][cAngle],CarInfo[scurrentveh2][cColorOne],CarInfo[scurrentveh2][cColorTwo],60000);
// CAR LOAD //
Re: Car Destroy -
lamarr007 - 28.08.2012
Are you using INI system or MySQL for saving player data?
Re: Car Destroy -
UnknownGamer - 28.08.2012
INI systems
Re: Car Destroy -
lamarr007 - 28.08.2012
Dini or Y_INI or?
Re: Car Destroy -
UnknownGamer - 28.08.2012
DINI, How wud i make car respawn?
Re: Car Destroy -
lamarr007 - 28.08.2012
pawn Код:
public OnPlayerConnect(playerid)
{
new model = dini_Int("yourplayerfile", "VehicleModel");
if(model != 0)
{
PlayerInfo[playerid][pPcarkey] = CreateVehicle(model, Float:dini_Float("yourplayerfile", "VehicleX"), Float:dini_Float("yourplayerfile", "VehicleY"), Float:dini_Float("yourplayerfile", "VehicleZ"), Float:dini_Float("yourplayerfile", "VehicleAngle"), -1, -1, 60);
}
return 1;
}
pawn Код:
public OnPlayerDisconnect(playerid)
{
new Float:VX, Float:VY, Float:VZ, Float:AN;
GetVehiclePos(PlayerInfo[playerid][pPcarkey], Float:VX, Float:VY, Float:VZ);
GetVehicleZAngle(PlayerInfo[playerid][pPcarkey], Float:AN);
dini_IntSet("yourplayerfile", "VehicleModel", CarInfo[scurrentveh][cModel]);
dini_FloatSet("yourplayerfile","VehicleX",VX);
dini_FloatSet("yourplayerfile","VehicleY",VY);
dini_FloatSet("yourplayerfile","VehicleY",VZ);
dini_FloatSet("yourplayerfile","VehicleAngle",AN);
return 1;
}
Try
Re: Car Destroy -
UnknownGamer - 28.08.2012
yourplayerfile,
that wont work as it needs to spawn from playerid
Also get unreachable code errors
Re: Car Destroy -
lamarr007 - 28.08.2012
I donґt know, what is your variable, which save playerґs vehicle.. and i donґt know, what is your path (stock) to get player file.. (therefore you get errors with
yourplayerfile variable)
Example of my stock function to get player path
pawn Код:
stock UserPath(playerid)
{
new path[48];
format(path, sizeof(path), "/data/players/%s.ini", GetName(playerid));
return path;
}