Vehicle selling
#1

Hello everyone! I coded a script to sell rare found vehicle - tampa which will be found around the map. Now my problem is, the vehicle doesn't destroy. I made the respawn time to be 5,000s but yet, it won't destroy. The code is:


Код:
CMD:selltampa(playerid, params[])
{   
	new vehmodel = GetVehicleModel(GetPlayerVehicleID(playerid));
	if (vehmodel == 549)
	{
	SendClientMessage(playerid, COLOR_YELLOW, "You found tampa! Congratulations! You earn 2000$!");
	DestroyVehicle(vehmodel);
	GivePlayerMoney(playerid, 2000);
	}
	else if(!vehmodel) return SendClientMessage(playerid, COLOR_RED, "You're not in tampa!");
    return 1;
}
If someone knows, I'll be more than glad to rep-up in a hour. That's when I can rep up.
Reply
#2

You need the vehicleid not the modelid in order to destroy a vehicle.

pawn Код:
CMD:selltampa(playerid, params[])
{
    if (GetVehicleModel(GetPlayerVehicleID(playerid)) != 549)  return SendClientMessage(playerid, COLOR_RED, "You're not in tampa!");
    DestroyVehicle(GetPlayerVehicleID(playerid));
    GivePlayerMoney(playerid, 2000);
    SendClientMessage(playerid, COLOR_YELLOW, "You found tampa! Congratulations! You earn 2000$!");
    return 1;
}
Reply
#3

try this.
Quote:

new carid = GetPlayerVehicleID(playerid);
DestroyVehicle(carid);

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)