Engine Command
#1

Does anyone have a CMD:engine and CMD:light command they can spare me so i can put it in my script?

My players keep pestering me about not having a engine/light system.

I want a trunk and hood system too but right now a engine and light system works.
Reply
#2

Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
	    if (newkeys == KEY_FIRE)
	    {
	        new string[128];
         	new vehicleid = GetPlayerVehicleID(playerid);
	        new engine, lights, alarm, doors, bonnet, boot, objective;
	        GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
	        if(engine == 0)
	        {
		        SetVehicleParamsEx(vehicleid, 1, lights, alarm, doors, bonnet, boot, objective);
		        TogglePlayerControllable(playerid,0);
		        SetTimerEx("Unfreeze", 2000, 0, "i", playerid);
		        for(new i=0; i<MAX_PLAYERS; i++)
				{
		    	if(GetDistanceBetweenPlayers(playerid,i) < 20)
		    	{
		        format(string,sizeof(string),"%s(%d) spins the vehicle's engine key and turns on the engine.",PlayerName(playerid),playerid);
				SendClientMessage(i,COLOR_SERVER,string);
				SendClientMessage(playerid,COLOR_SERVER,"Engine Successfully started!");
				}
				}
		    }
	        else
	        {
	            TogglePlayerControllable(playerid,0);
		        SetTimerEx("Unfreeze", 1000, 0, "i", playerid);
				SetVehicleParamsEx(vehicleid, 0, lights, alarm, doors, bonnet, boot, objective);
		        SendClientMessage(playerid,COLOR_RED,"Engine Turned Off!");
			}
	    }
	}
	return 1;
}
that is for engine ...starting engine with left mouse click ,, you can edit it ,, and for lights princip is same , just instead that engine parametar change lights parametar
Reply
#3

Thank you very much i really needed this!
Reply
#4

Put that code under public OnPlayerCommandText(playerid, cmdtext[]) instead of OnPlayerKeyStateChange(playerid, newkeys, oldkeys) and just add : example

if (strcmp("/engine", cmdtext, true, 10) == 0) instead of my if (newkeys == KEY_FIRE) and thats it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)