04.05.2015, 14:23
Код:
CMD:veh(playerid, params[]) { new Vehicle[50], VehicleID, Color[2], Siren, Float:pX, Float:pY, Float:pZ, Float:pA, string[512]; format(string, sizeof(string), "[USAGE]: /veh [VehicleName/VehicleID] [Color 1 (optional)] [Color 2 (optional)] [Siren 0/1 (optional)]"); if(sscanf(params, "s[50]D(0)D(0)D(0)", Vehicle, Color[0], Color[1], Siren)) return SendClientMessage(playerid, -1, string); VehicleID = GetVehicleIDFromName(Vehicle); if(VehicleID == -1) { VehicleID = strval(Vehicle); } format(string, sizeof(string), "[WARNING]: Invalid vehicle ID! To find vehicle's ID use /vid."); if(VehicleID < 400 || VehicleID > 611) return SendClientMessage(playerid, -1, string); if(Siren < 0 || Siren > 1) return SendClientMessage(playerid, -1, "[INFO]: Add siren 0/1. 0 - No, 1 - Yes."); if(IsPlayerInAnyVehicle(playerid) == 1) return SendClientMessage(playerid, -1, "[WARNING]: You are now in vehicle. Please exit and then spawn new one!"); GetPlayerPos(playerid, pX, pY, pZ); GetPlayerFacingAngle(playerid, pA); DestroyVehicle(SpawnedVehicle[playerid]); SpawnedVehicle[playerid] = CreateVehicle(VehicleID, pX, pY, pZ + 0.5, pA, Color[0], Color[1], -1, Siren); LinkVehicleToInterior(SpawnedVehicle[playerid], GetPlayerInterior(playerid)); SetVehicleVirtualWorld(SpawnedVehicle[playerid], GetPlayerVirtualWorld(playerid)); PutPlayerInVehicle(playerid, SpawnedVehicle[playerid], 0); format(string, sizeof(string), "[INFO]: You successfully spawned \"%s\" (ID: %d). Enjoy it!", GetVehicleName(GetPlayerVehicleID(playerid)), GetVehicleIDFromName(GetVehicleName(GetPlayerVehicleID(playerid)))); SendClientMessage(playerid, -1, string); return 1; }