SA-MP Forums Archive
Turning Of the engine 0.3c - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Turning Of the engine 0.3c (/showthread.php?tid=204426)



Turning Of the engine 0.3c - Osviux - 29.12.2010

Hey, could someone give me a line that shutdowns the vehicles engine? (0.3c)


Re: Turning Of the engine 0.3c - TopAz07 - 29.12.2010

Код:
if(strcmp("/engine", cmdtext, true, 10) == 0)
	{
	    new engine,lights,alarm,doors,bonnet,boot,objective;
	    new veh = GetPlayerVehicleID(playerid);
		if(IsPlayerInAnyVehicle(playerid))
		{
			if(veh != INVALID_VEHICLE_ID)
			{
				if(EngineStatus[playerid] == 0)
				{
					GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
					SetVehicleParamsEx(veh,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
					EngineStatus[playerid] = 1;
					SendClientMessage(playerid, 0xFFFFFFAA, "You've turned the vehicle's engine {2F991A}on!");
                    return 1;
				}
				else if(EngineStatus[playerid] == 1)
				{
					GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
					SetVehicleParamsEx(veh,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
					EngineStatus[playerid] = 0;
					SendClientMessage(playerid, 0xFFFFFFAA, "You've turned the vehicle's engine {E31919}off!");
					return 1;
				}
			}
		}
		else {
		SendClientMessage(playerid, 0x00FF00FF, "{E31919}You are not in a vehicle!");
		return 1;
		}
	}
I copy it from my gamemode


Re: Turning Of the engine 0.3c - Joe Staff - 29.12.2010

Quote:

SendClientMessage(playerid, 0x00FF00FF, "{E31919}You are not in a vehicle!");

Wow, really? You set the color of the message and then use an embed to change the entire message color?

pawn Код:
//OnPlayerCommandText
    if(!strcmp(cmdtext,"/engine",true))
    {
        if(!IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid,0xFF0000FF,"You are not in a vehicle!");
        new engine, lights, alarm, doors, bonnet, boot, objective, vehid=GetPlayerVehicleID(playerid);
        GetVehicleParamsEx(vehid,engine, lights, alarm, doors, bonnet, boot, objective);
        if(!engine)
        {
            SetVehicleParamsEx(vehid,1,lights,alarm,doors,bonnet,boot,objective);
            return SendClientMessage(playerid,0xAAAAAAFF,"Vehicle started!");
        }else{
            SetVehicleParamsEx(vehid,0,lights,alarm,doors,bonnet,boot,objective);
            return SendClientMessage(playerid,0xAAAAAAFF,"Vehicle turned off!");
        }
    }