24.05.2012, 23:57
The first thing I need help with is being able to limit the car ID that can be chosen with my spawn car command. Basically if the user of the command chooses a car ID below 400 and above 611 it comes up with an error message.
My includes:
The command:
The second thing I need help with is being able to turn on a car engine and turn it off with the same command. At the moment I have it as two separate commands and I would like to know how I can make them one command. Same script as the last command so its the same includes.
Commands:
Thanks for any help you provide!
My includes:
Код:
#include <a_samp> #include <core> #include <float> #include <sscanf2> #include <zcmd> #include <foreach>
Код:
CMD:spawnveh(playerid, params[]) { new Float:x, Float:y, Float:z, Float:ang, color1, color2, id; { if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "You are not an admin!"); { if(sscanf(params, "iii", id, color1, color2)) return SendClientMessage(playerid, COLOR_GREY, "Usage: /spawnveh [400-611] [color id] [color id]"); GetPlayerPos(playerid,x,y,z); GetPlayerFacingAngle(playerid, ang); CreateVehicle(id, x, y, z, ang, color1, color2, 90000); SendClientMessage(playerid, COLOR_GREEN, "You have spawned a car!"); } return 1; } }
Commands:
Код:
CMD:engineon(playerid, params[]) { new vehicle, string[128], engine, lights, alarm, doors, bonnent, boot, objective; vehicle = GetPlayerVehicleID(playerid); { if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "You are not in any vehicle!"); GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnent, boot, objective); SetVehicleParamsEx(vehicle, 1, lights, alarm, doors, bonnent, boot, objective); format(string, sizeof(string), "%s puts their keys in the ignition and starts the car.", GetName(playerid)); ProxDetector(30, playerid, string, COLOR_PURPLE); } return 1; } CMD:engineoff(playerid, params[]) { new vehicle, string[128], engine, lights, alarm, doors, bonnent, boot, objective; vehicle = GetPlayerVehicleID(playerid); { if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "You are not in any vehicle!"); GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnent, boot, objective); SetVehicleParamsEx(vehicle, 0, lights, alarm, doors, bonnent, boot, objective); format(string, sizeof(string), "%s takes their keys out of the ignition and shuts off the car.", GetName(playerid)); ProxDetector(30, playerid, string, COLOR_PURPLE); } return 1; }
