Lights day |||| Lights night
#1

How i enable that lights will be able to see in day?
Reply
#2

Put this on your OnGameModeInit()

pawn Код:
ManualVehicleEngineAndLights();
Here's a simple /lights command

pawn Код:
if(strcmp(cmd, "/lights", true) == 0)
        {
        if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            new vid = GetPlayerVehicleID(playerid);
            new engine, light, alarm, doors, bonnet, boot, objective;
            GetVehicleParamsEx(vid, engine, light, alarm, doors, bonnet, boot, objective);
            if(light != VEHICLE_PARAMS_ON)
            {
                GameTextForPlayer(playerid, "~w~Lights ~g~On", 2000, 4);
                SetVehicleParamsEx(vid, engine, VEHICLE_PARAMS_ON, alarm, doors, bonnet, boot, objective);
                return 1;
            }
            GameTextForPlayer(playerid, "~w~Lights ~r~Off", 2000, 4);
            SetVehicleParamsEx(vid, engine, VEHICLE_PARAMS_OFF, alarm, doors, bonnet, boot, objective);
            return 1;
        }
        else
        {
            SendClientMessage(playerid, COLOR_ORANGE, "[ERROR:] You are not in a vehicle as a driver.");
        }
        return 1;
    }
Reply
#3

Thanks.
can you give me a commands that open car hood,doors,panel,and etc.
Reply
#4

pawn Код:
if(strcmp(cmd, "/hood", true) == 0)
        {
        if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            new vid = GetPlayerVehicleID(playerid);
            new engine, light, alarm, doors, bonnet, boot, objective;
            GetVehicleParamsEx(vid, engine, light, alarm, doors, bonnet, boot, objective);
            if(bonnet != VEHICLE_PARAMS_ON)
            {
                SetVehicleParamsEx(vid, engine, light, alarm, doors, VEHICLE_PARAMS_ON, boot, objective);
                return 1;
            }
            SetVehicleParamsEx(vid, engine, light, alarm, doors, VEHICLE_PARAMS_OFF, boot, objective);
            return 1;
        }
        else
        {
            SendClientMessage(playerid, COLOR_ORANGE, "[ERROR:] You are not in a vehicle as a driver.");
        }
        return 1;
    }

if(strcmp(cmd, "/trunk", true) == 0)
        {
        if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            new vid = GetPlayerVehicleID(playerid);
            new engine, light, alarm, doors, bonnet, boot, objective;
            GetVehicleParamsEx(vid, engine, light, alarm, doors, bonnet, boot, objective);
            if(boot!= VEHICLE_PARAMS_ON)
            {
                SetVehicleParamsEx(vid, engine, light, alarm, doors, bonnet, VEHICLE_PARAMS_ON, objective);
                return 1;
            }
            SetVehicleParamsEx(vid, engine, light, alarm, doors, bonnet,  VEHICLE_PARAMS_OFF, objective);
            return 1;
        }
        else
        {
            SendClientMessage(playerid, COLOR_ORANGE, "[ERROR:] You are not in a vehicle as a driver.");
        }
        return 1;
    }
Reply
#5

What is the problem at this command?

Код:
if(strcmp(cmd, "/car", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
		{
			new x_v[256];
		    x_v = strtok(cmdtext, idx);
			if(!strlen(x_v))
			{
				SendClientMessage(playerid, COLOR_LIGHTBLUE, "{33CCFF}USAGE:{FFFFFF} /car [Action]");
				SendClientMessage(playerid, COLOR_YELLOW2, "lights, hood, trunk");
				return 1;
	        }
	        if(!strcmp(x_v, "lights",true))
		    {
			if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
			{
            new vid = GetPlayerVehicleID(playerid);
            new engine, light, alarm, doors, bonnet, boot, objective;
            GetVehicleParamsEx(vid, engine, light, alarm, doors, bonnet, boot, objective);
            if(light != VEHICLE_PARAMS_ON)
            {
                GameTextForPlayer(playerid, "~w~Lights ~g~On", 2000, 4);
                SetVehicleParamsEx(vid, engine, VEHICLE_PARAMS_ON, alarm, doors, bonnet, boot, objective);
                return 1;
            }
            GameTextForPlayer(playerid, "~w~Lights ~r~Off", 2000, 4);
            SetVehicleParamsEx(vid, engine, VEHICLE_PARAMS_OFF, alarm, doors, bonnet, boot, objective);
            return 1;
	        }
			else if(!strcmp(x_v, "hood",true))
		    {
			if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
			{
			new vid = GetPlayerVehicleID(playerid);
			new engine, light, alarm, doors, bonnet, boot, objective;
			GetVehicleParamsEx(vid, engine, light, alarm, doors, bonnet, boot, objective);
			if(bonnet != VEHICLE_PARAMS_ON)
			{
			SetVehicleParamsEx(vid, engine, light, alarm, doors, VEHICLE_PARAMS_ON, boot, objective);
			return 1;
			}
			SetVehicleParamsEx(vid, engine, light, alarm, doors, VEHICLE_PARAMS_OFF, boot, objective);
			return 1;
			}
			else
			{
				SendClientMessage(playerid, COLOR_ORANGE, "[ERROR:] You are not in a vehicle as a driver.");
			}
			return 1;
	        }
			else if(!strcmp(x_v, "trunk",true))
		    {
			if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
			{
			new vid = GetPlayerVehicleID(playerid);
			new engine, light, alarm, doors, bonnet, boot, objective;
			GetVehicleParamsEx(vid, engine, light, alarm, doors, bonnet, boot, objective);
			if(boot!= VEHICLE_PARAMS_ON)
			{
			SetVehicleParamsEx(vid, engine, light, alarm, doors, bonnet, VEHICLE_PARAMS_ON, objective);
			return 1;
			}
			SetVehicleParamsEx(vid, engine, light, alarm, doors, bonnet,  VEHICLE_PARAMS_OFF, objective);
			return 1;
			}
			else
			{
			SendClientMessage(playerid, COLOR_ORANGE, "[ERROR:] You are not in a vehicle as a driver.");
			}
			return 1;
			}
		  }
		  return 1;
		}
	}
Reply
#6

I don't know really. I'm tired atm, try debugging your code with print() and see where it stops.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)