SA-MP Forums Archive
Lights day |||| Lights night - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Lights day |||| Lights night (/showthread.php?tid=354535)



Lights day |||| Lights night - PaulDinam - 27.06.2012

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


Re: Lights day |||| Lights night - Makaveli93 - 27.06.2012

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;
    }



Re: Lights day |||| Lights night - PaulDinam - 27.06.2012

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


Re: Lights day |||| Lights night - Makaveli93 - 27.06.2012

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;
    }



Re: Lights day |||| Lights night - PaulDinam - 27.06.2012

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;
		}
	}



Re: Lights day |||| Lights night - Makaveli93 - 27.06.2012

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