DestroyCar help - 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: DestroyCar help (
/showthread.php?tid=323162)
DestroyCar help -
new121 - 04.03.2012
Ok so I am making a car dealership system in my game mode, when a player enters a dealership car it shows them a dialog if they click yes they buy the car and it spawns it for them , everything works but now I am trying to make it so when they log out it destroys their car, and when they log back in it respawns it where they did /park , , I made the /park cmd and it works but what I don't know how to do is DestroyCar because it needs a car id and I got no idea what the car id of the players car when he buys it anyways it just makes a random one.
Here is the code from OnDialogResponse where the player buys the car, maybe somoene can help.
pawn Код:
if(dialogid == 1000)
{
if(response)
{
if(PlayerInfo[playerid][pCash] >= 1000)
{
SendClientMessage(playerid, COLOR_GREEN, " You have bought a landstalker for 1000 dollars! ");
PlayerInfo[playerid][pCar] = 400;
CreateVehicle(400, 553.4318,-1200.6570,17.3407, 120, 0, 0, 9999);
RemovePlayerFromVehicle(playerid);
TogglePlayerControllable(playerid, 1);
GivePlayerCash(playerid, -1000);
}
else
{
SendClientMessage(playerid, COLOR_RED, " You don't even have enough money...");
}
}
else
{
RemovePlayerFromVehicle(playerid);
TogglePlayerControllable(playerid, 1);
}
Re: DestroyCar help -
coole210 - 04.03.2012
pawn Код:
new carid = CreateVehicle(400, 553.4318,-1200.6570,17.3407, 120, 0, 0, 9999);
PlayerInfo[playerid][pCar] = carid;
Re: DestroyCar help -
new121 - 04.03.2012
Quote:
Originally Posted by coole210
pawn Код:
new carid = CreateVehicle(400, 553.4318,-1200.6570,17.3407, 120, 0, 0, 9999); PlayerInfo[playerid][pCar] = carid;
|
Wont that make it so if player a and player b buy a car then player a logs wont player a and player b's car dissapear?
Re: DestroyCar help -
coole210 - 04.03.2012
...
pawn Код:
new carid = CreateVehicle(400, 553.4318,-1200.6570,17.3407, 120, 0, 0, 9999);
PlayerInfo[playerid][pCarModel] = 400;
PlayerInfo[playerid][pCarID] = carid;
//OnPlayerConnect:
PlayerInfo[playerid][pCarID] = -1;
//OnPlayerDisconnect:
if(PlayerInfo[playerid][pCarID] != -1)
{
DestroyVehicle(PlayerInfo[playerid][pCarID]);
PlayerInfo[playerid][pCarID] = -1;
}
Re: DestroyCar help -
new121 - 04.03.2012
Quote:
Originally Posted by coole210
...
pawn Код:
new carid = CreateVehicle(400, 553.4318,-1200.6570,17.3407, 120, 0, 0, 9999); PlayerInfo[playerid][pCarModel] = 400; PlayerInfo[playerid][pCarID] = carid;
//OnPlayerConnect:
PlayerInfo[playerid][pCarID] = -1;
//OnPlayerDisconnect: if(PlayerInfo[playerid][pCarID] != -1) { DestroyVehicle(PlayerInfo[playerid][pCarID]); PlayerInfo[playerid][pCarID] = -1; }
|
Ok that works thanks