05.04.2018, 12:09
How to call a command using pawncmd?
CMD:engine(playerid, params[]) { if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "ERROR:You must be in a car."); new vehicleid, engine, lights, alarm, doors, bonnet, boot, objective; vehicleid = GetPlayerVehicleID(playerid); GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective); if(engineo[vehicleid] == true) { return SetVehicleParamsEx(vehicleid, VEHICLE_PARAMS_OFF, lights, alarm, doors, bonnet, boot, objective), engineo[vehicleid] = false, GameTextForPlayer(playerid, "~n~~n~Engine~r~~h~Off", 2000, 4); //SendClientMessage(playerid, COLOR_RED, "Engine succesfully stoped."); } if(engineo[vehicleid] == false) { return SetVehicleParamsEx(vehicleid, VEHICLE_PARAMS_ON, lights, alarm, doors, bonnet, boot, objective), engineo[vehicleid] = true, GameTextForPlayer(playerid, "~n~~n~Engine~g~~h~On", 2000, 4); //SendClientMessage(playerid, COLOR_YELLOW, "Engine succesfully starts."); } return 1; }
if (GetPlayerVehicleSeat(playerid) == 0) { if (newkeys & KEY_SUBMISSION) { return CallLocalFunction( "cmd_engine", "i", playerid); } }
if (GetPlayerVehicleSeat(playerid) == 0) { if (newkeys & KEY_SUBMISSION) { return PC_EmulateCommand(playerid, "/engine"); } }
callcmd::engine(playerid, params[]);
PC_EmulateCommand(playerid, "/engine");