SA-MP Forums Archive
/engine - 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: /engine (/showthread.php?tid=278259)



/engine - uprp - 21.08.2011

I want to add /engine

What's the full command, to do it?

I'm a newbie, but dont say anything about that stuff.

/engine turns on / off your car.


Re: /engine - Basicz - 21.08.2011

Hello, I guess don't make a Roleplay server first for your first gamemode, but sure, here it is:
Quote:
Originally Posted by Basicz
View Post
I think you need to use a variable. Like:
pawn Code:
new
    vEngine[ MAX_VEHICLES ]
;

public OnGameModeInit( )
{
    ManualVehicleEngineAndLights( );

    return 1;
}

public OnVehicleSpawn( vehicleid )
{
    vEngine[ vehicleid ] = 0;

    return 1;
}

COMMAND:engine( playerid, params[ ] )
{
    if ( !IsPlayerInAnyVehicle( playerid ) )
        return SendClientMessage( playerid, -1, "You are not in any vehicle." );

    new vid = GetPlayerVehicleID( playerid ), engine, lights, alarm, doors, bonnet, boot, objective;

    GetVehicleParamsEx(vid, engine, lights, alarm, doors, bonnet, boot, objective);

    switch( vEngine[ vid ] )
    {
        case 0: vEngine[ vid ] = 1, SetVehicleParamsEx( vid, 1, lights, alarm, doors, bonnet, boot, objective ),        SendClientMessage( playerid, -1, "turned on" );
        default: vEngine[ vid ] = 0, SetVehicleParamsEx( vid, 0, lights, alarm, doors, bonnet, boot, objective ),
                   SendClientMessage( playerid, -1, "turned off" );
    }

    return 1;
}
Hope it helps.
You need ZCMD include, put it at 'Sampservdirectory/pawno/include/".
****** ZCMD and you'll find it. ( ZCMD SA-MP ) in ******.