SA-MP Forums Archive
Help /engine[rep] - 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: Help /engine[rep] (/showthread.php?tid=316815)



Help /engine[rep] - Dan_Barocu - 08.02.2012

Help if i put this then play can stay in vehicle and turn wheels left right can someone help me..with it.


Re: Help /engine[rep] - Tannz0rz - 08.02.2012

Simply make use of Get/SetVehicleParamsEx as such:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/engine", true))
    {
        new
            veh = GetPlayerVehicleID(playerid);
           
        if(veh != 0 && GetPlayerVehicleSeat(playerid) == 0)
        {
            new
                engine,
                lights,
                alarm,
                doors,
                bonnet,
                boot,
                objective;
           
            GetVehicleParamsEx(veh, engine,  lights, alarm, doors, bonnet, boot, objective);
            SetVehicleParamsEx(veh, !engine, lights, alarm, doors, bonnet, boot, objective);
        }
       
        return true;
    }

    return false;
}



Re: Help /engine[rep] - Dan_Barocu - 08.02.2012

is there another option?


Re: Help /engine[rep] - Tannz0rz - 08.02.2012

Quote:
Originally Posted by Dan_Barocu
Посмотреть сообщение
is there another option?
I don't understand? It does exactly what you said you wanted it to do.


Re: Help /engine[rep] - Dan_Barocu - 08.02.2012

it says not responding at pawno..


Re: Help /engine[rep] - Tannz0rz - 08.02.2012

Quote:
Originally Posted by Dan_Barocu
Посмотреть сообщение
it says not responding at pawno..
Then it probably has nothing to do with that snippet, as I used it as a filterscript and it compiled and ran fine.


Re: Help /engine[rep] - Dan_Barocu - 08.02.2012

well there is another way..i had it and now i dont..


Re: Help /engine[rep] - Dan_Barocu - 11.02.2012

Quote:
Originally Posted by Tannz0rz
Посмотреть сообщение
Simply make use of Get/SetVehicleParamsEx as such:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/engine", true))
    {
        new
            veh = GetPlayerVehicleID(playerid);
           
        if(veh != 0 && GetPlayerVehicleSeat(playerid) == 0)
        {
            new
                engine,
                lights,
                alarm,
                doors,
                bonnet,
                boot,
                objective;
           
            GetVehicleParamsEx(veh, engine,  lights, alarm, doors, bonnet, boot, objective);
            SetVehicleParamsEx(veh, !engine, lights, alarm, doors, bonnet, boot, objective);
        }
       
        return true;
    }

    return false;
}
where do i make a sendclientmessage"Engine on"Engine off"??in this cmd


Re: Help /engine[rep] - Tannz0rz - 12.02.2012

Quote:
Originally Posted by Dan_Barocu
Посмотреть сообщение
where do i make a sendclientmessage"Engine on"Engine off"??in this cmd
pawn Код:
SendClientMessage(playerid, -1, ((engine) ? ("Vehicle turned OFF") : ("Vehicle turned ON")));
As I said, I suggest that you read some tutorials.

GetVehicleParamsEx gets the status of the vehicle for several components (as one of the observational sort may have noticed)-- the engine, lights, alarm, doors, bonnet and boot. The status of the engine is stored in the "engine" variable I created, which is either 0 (off) or 1 (on).

In SetVehicleParamsEx, I set all specified parameters as retrieved from GetVehicleParamsEx, however, I use the "logical NOT" operator on "engine" (if the value of the operand is 0, the value returned is 1, else the value of 0 is returned). So if "engine" is off (engine = 0), I set it to 1. If the engine is on (engine = 1), I set it to 0.


Re: Help /engine[rep] - Dan_Barocu - 17.02.2012

i put this /engine cmd i cant move and i Cant move wheels left right..

Код:
if(strcmp(cmd, "/engine", true) == 0)
	{
	new veh = GetPlayerVehicleID(playerid);
	if(veh != 0 && GetPlayerVehicleSeat(playerid) == 0)
	{
	new
	engine,
	lights,
	alarm,
	doors,
	bonnet,
	boot,
	objective;
	GetVehicleParamsEx(veh, engine,  lights, alarm, doors, bonnet, boot, objective);
    SetVehicleParamsEx(veh, !engine, lights, alarm, doors, bonnet, boot, objective);
	}
	return true;
	}