/engine question
#1

Hey.. I'm trying to make that you wont have to type /engine if you drive bicycles... well I tried to make a foward + public of the vehiclemodel but it didnt help.. the last thing I tried is that:


pawn Код:
on:
public OnPlayerStateChange(playerid, newstate, oldstate)

if(GetVehicleModel(newcar) == 481 || GetVehicleModel(newcar) == 509 || GetVehicleModel(newcar) == 510)//BMX
        {
            new vehicleid = GetPlayerVehicleID(playerid);
            new engine, lights, alarm, doors, bonnet, boot, objective;
            GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
            SetVehicleParamsEx(vehicleid, 1, lights, alarm, doors, bonnet, boot, objective);
            return 1;
        }

and my /engine command:

pawn Код:
if(!strcmp(cmd, "/engine", true))
    {
        new vehicleid = GetPlayerVehicleID(playerid);
        new engine, lights, alarm, doors, bonnet, boot, objective;
        GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
        if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            GetPlayerName(playerid, sendername, sizeof(sendername));
            format(string, sizeof(string), "* %s puts the keys and turn on the engine.", sendername);
            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            if(engine == 1)
            {
                SetVehicleParamsEx(vehicleid, 0, lights, alarm, doors, bonnet, boot, objective);
                GetPlayerName(playerid, sendername, sizeof(sendername));
                format(string, sizeof(string), "* %s Turn off the engine and take the keys.", sendername);
                ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            }
            else
            {
                SetVehicleParamsEx(vehicleid, 1, lights, alarm, doors, bonnet, boot, objective);
            }
        }
        return 1;
    }
Reply
#2

You mean you still have to type /engine to drive bicycle?
Reply
#3

Try this;

Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
	if(newstate == PLAYER_STATE_DRIVER)
	{
    	new vehicleid = GetPlayerVehicleID(playerid);
		if(GetVehicleModel(vehicleid) == 481 || GetVehicleModel(vehicleid) == 509 || GetVehicleModel(vehicleid) == 510)//BMX
		{
    		new engine, lights, alarm, doors, bonnet, boot, objective;
    		GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
   		 	SetVehicleParamsEx(vehicleid, 1, lights, alarm, doors, bonnet, boot, objective);
		}
	}
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	if(!strcmp(cmdtext, "/engine", true))
    {
        new vehicleid = GetPlayerVehicleID(playerid);
        new engine, lights, alarm, doors, bonnet, boot, objective;
        GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
        if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            new sendername[MAX_PLAYER_NAME], string[128];
            GetPlayerName(playerid, sendername, sizeof(sendername));
            format(string, sizeof(string), "* %s puts the keys and turn on the engine.", sendername);
            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            if(engine == 1)
            {
                SetVehicleParamsEx(vehicleid, 0, lights, alarm, doors, bonnet, boot, objective);
                GetPlayerName(playerid, sendername, sizeof(sendername));
                format(string, sizeof(string), "* %s Turn off the engine and take the keys.", sendername);
                ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            }
            else
            {
                SetVehicleParamsEx(vehicleid, 1, lights, alarm, doors, bonnet, boot, objective);
            }
        }
        return 1;
    }
	return 0;
}
Hope this helps/works
Reply
#4

I tried it,thanks but wasnt working

and yea.. if you enter a bicycles you have to type /engine to start drive it...

more ideas?
Reply
#5

You mean you want to do /engine for EVERY vehicle in the game?
Reply
#6

What is "newcar"?
If that's the vehicle's ID, why you get the ID again in "vehicleid"?
Reply
#7

Right now.. every vehicle you enter.. doesnt matter what kind it is.. you have to type /engine to start drive..
but I DONT want bicycles to work this way.... so I took only bicycles ids ...

now expalin it better?: )


And I dont take the vehicleid... I use the vehicle model..
cuz I dont wanna check every bicycle id..
Reply
#8

pawn Код:
GetVehicleModel(vehicleid);
That's what I mean.

Perhaps show us some code below that code where you get the ID?
Reply
#9

Below this part? I showed you, and blow that its the rest of the public..
Reply
#10

I mean above (Damn, my bad), where you get the vehicle ID and store it in "newcar".
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)