10.07.2014, 13:00
Hi guys i have a /car code here
And the problem is, the car didnt dissapeared or destroyed when i spawn a new one :/ Anyone how can i do that? Thanks.
Код:
CMD:car(playerid, params[]) { if(PlayerInfo[playerid][Jailed] == true) return SendClientMessage(playerid, COLOR_RED, "You can't use this command when you are in jail"); if(PlayerInfo[playerid][World] != DMWorldID && PlayerInfo[playerid][World] != TDMWorldID) { if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER) return SendClientMessage(playerid, COLOR_RED, "ERROR: you need to be the driver of the vehicle or be onfoot to use this command"); new aVehicle[64], Color1, Color2; if(sscanf(params, "s[64]I(-1)I(-1)", aVehicle, Color1, Color2)) return SendClientMessage(playerid,COLOR_YELLOW, "Correct usage: /car [car ID/name] [color1] [color2]"); new veh = GetVehicleModelID(aVehicle); if(veh < 400 || veh > 611) return SendClientMessage(playerid,COLOR_RED, "ERROR: This is not a valid vehicle name! Please try again "); if(IsPlayerInAnyVehicle(playerid)) DestroyVehicle(GetPlayerVehicleID(playerid)); new Float:Pos[4]; GetPlayerPos(playerid, Pos[0],Pos[1],Pos[2]); GetPlayerFacingAngle(playerid, Pos[3]); new PVeh = CreateVehicle(veh, Pos[0], Pos[1], Pos[2], Pos[3]+90, Color1, Color2, -1); LinkVehicleToInterior(PVeh, GetPlayerInterior(playerid)); SetVehicleVirtualWorld(PVeh, GetPlayerVirtualWorld(playerid)); PutPlayerInVehicle(playerid, PVeh, 0); vehhasmissile[veh] = 0; vehhasminigun[veh] = 0; vehhascargo[veh] = 0; vehhaswindshieldupgrade[veh] = 0; vehhascarwreck[veh] = 0; SendCommandToAdmins(playerid,"/car"); GameTextForPlayer(playerid, "~y~Enjoy your new ~r~ride", 2000, 1); return 1; } else return SendClientMessage(playerid, COLOR_RED, "ERROR: you can't use this command in this world"); }