#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; } }
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; }
if(id > 399 && id < 612) //if id is bigger than 399 and lower than 612
{
//spawn the vehicle
}
pawn Код:
|
new IsEngineOn[MAX_VEHICLES];
CMD:engine(playerid, params[])
{
new vehicle, string[128], engine, lights, alarm, doors, bonnent, boot, objective;
vehicle = GetPlayerVehicleID(playerid);
GetVehicleParamsEx(vehicle, engine, lights, alarm, doors, bonnent, boot, objective);
if(!IsPlayerInAnyVehicle(playerid))
{
SendClientMessage(playerid, COLOR_RED, "You are not in any vehicle!");
return 1;
}
if(IsEngineOn[vehicle] == 0)
{
SetVehicleParamsEx(vehicle, 1, lights, alarm, doors, bonnent, boot, objective);
IsEngineOn[vehicle] = 1;
format(string, sizeof(string), "%s puts their keys in the ignition and starts the car.", GetName(playerid));
}
else if(IsEngineOn[vehicle] == 1)
{
SetVehicleParamsEx(vehicle, 0, lights, alarm, doors, bonnent, boot, objective);
IsEngineOn[vehicle] = 0;
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;
}
This should cover your /engineon and /engineoff commands;
pawn Код:
Jesse |