29.08.2015, 14:36
when i do /car the previous car i spawned should be destroyed and the new one is spawned but the previous car doesnt disappear , any help ?
Код:
CMD:car(playerid,params[]) { if(!IsPlayerInAnyVehicle(playerid)) { new tmp[128], tmp2[128], tmp3[128], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index); tmp3 = strtok(params,Index); if(isnull(tmp)) return SendClientMessage(playerid, -1, "USAGE: /car [Modelid/Name] [colour1] [colour2]"); new car, colour1, colour2, string[128]; if(!IsNumeric(tmp)) car = GetVehicleModelIDFromName(tmp); else car = strval(tmp); if(car < 400 || car > 611) return SendClientMessage(playerid, -1, "ERROR: Invalid Vehicle Model"); if(isnull(tmp2)) colour1 = random(126); else colour1 = strval(tmp2); if(isnull(tmp3)) colour2 = random(126); else colour2 = strval(tmp3); new LVehicleID,Float:X,Float:Y,Float:Z, Float:Angle,int1; GetPlayerPos(playerid, X,Y,Z); GetPlayerFacingAngle(playerid,Angle); int1 = GetPlayerInterior(playerid); DestroyVehicle(LVehicleID); LVehicleID = CreateVehicle(car, X,Y,Z, Angle, colour1, colour2, -1); LinkVehicleToInterior(LVehicleID,int1); format(string, sizeof(string), "You have spawned a \"%s\" (Model:%d) colour (%d, %d)", VehicleName[car-400], car, colour1, colour2); PutPlayerInVehicle(playerid, LVehicleID, 0); VehicleInfo[LVehicleID][Temp] = 1; return SendClientMessage(playerid,-1, string); } else { SendClientMessage(playerid,-1,"You are already in a vehicle!"); } return 1; }