Help /engine[rep]
#1

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

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;
}
Reply
#3

is there another option?
Reply
#4

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.
Reply
#5

it says not responding at pawno..
Reply
#6

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.
Reply
#7

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

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
Reply
#9

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.
Reply
#10

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


Forum Jump:


Users browsing this thread: 1 Guest(s)