04.09.2012, 16:07
Guys this is my vehicle command I want that if player spawns a new car old one despawn can I do so?
pawn Код:
YCMD:veh(playerid, params[])
{
if(gPlayerLoggedIn[playerid] == 0) return 1;
if(PlayerInfo[playerid][Admin] >= 4) {
new model[128], color1, color2;
if(sscanf( params, "s[128]dd", model, color1, color2)) return SendClientMessage(playerid, COLOR_WHITE, "[USAGE]: /veh [Vehicle name] [Color1] [Color2]");
new Float:X, Float:Y, Float:Z, Float:A;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, A);
new car = ReturnVehicleModelID(model);
if(!car) return SendClientMessage(playerid, COLOR_WHITE, "Unable to find that Vehicle name.");
new carid = CreateVehicle(car, X,Y,Z,A, color1, color2, 0);
PutPlayerInVehicle(playerid,carid,0);
LinkVehicleToInterior(carid,GetPlayerInterior(playerid));
for(new i = 0; i < sizeof(CreatedCars); i++)
{
if(CreatedCars[i] == INVALID_VEHICLE_ID)
{
CreatedCars[i] = carid;
break;
}
}
SendClientMessage(playerid, COLOR_WHITE, "You have spawned a vehicle.");
}
return 1;
}