DestroyCar help
#1

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);
        }
Reply
#2

pawn Код:
new carid = CreateVehicle(400, 553.4318,-1200.6570,17.3407, 120, 0, 0, 9999);
PlayerInfo[playerid][pCar] = carid;
Reply
#3

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?
Reply
#4

...

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;
}
Reply
#5

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)