SA-MP Forums Archive
need help [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: need help [Rep ++] (/showthread.php?tid=398756)



need help [Rep ++] - Scott Zulkifli - 11.12.2012

I want a command like unlimited nos.[if I press alt just nos out, if I do not press alt nos not out.]
and I would like to command such a car can not be crushed.

using ZCMD,
thanks


Re: need help [Rep ++] - Konstantinos - 11.12.2012

pawn Код:
public OnPlayerKeyStateChange( playerid, newkeys, oldkeys )
{
    if( ( newkeys & KEY_ACTION ) && !( oldkeys & KEY_ACTION ) )
    {
        if( GetPlayerState( playerid ) == PLAYER_STATE_DRIVER && IsNosVehicle( GetPlayerVehicleID( playerid ) ) )
        {
            AddVehicleComponent( GetPlayerVehicleID( playerid ), 1010 );
        }
        return 1;
    }
    return 1;
}

IsNosVehicle( vehicleid )
{
    #define NO_NOS_VEHICLES 52
    new
        InvalidNosVehicles[ NO_NOS_VEHICLES ] =
        {
            581, 523, 462, 521, 463, 522, 461, 448, 468, 586, 417, 425, 469, 487, 512, 520, 563, 593,
            509, 481, 510, 472, 473, 493, 520, 595, 484, 430, 453, 432, 476, 497, 513, 533, 577,
            452, 446, 447, 454, 590, 569, 537, 538, 570, 449, 519, 460, 488, 511, 519, 548, 592
        }
    ;
    for( new i = 0; i < NO_NOS_VEHICLES; i ++ )
    {
        if( GetVehicleModel( vehicleid ) == InvalidNosVehicles[ i ] ) return false;
    }
    return true;
}
Everytime, you press ALT GR/LCTRL/NUM0 and you're driving, it gives you nos. Without pressing these buttons at all, I could only think a timer that it gives nitro, but I wouldn't recomment it.
I don't understand the second one.


Re: need help [Rep ++] - jueix - 11.12.2012

Quote:
Originally Posted by Dwane
Посмотреть сообщение
pawn Код:
public OnPlayerKeyStateChange( playerid, newkeys, oldkeys )
{
    if( ( newkeys & KEY_ACTION ) && !( oldkeys & KEY_ACTION ) )
    {
        if( GetPlayerState( playerid ) == PLAYER_STATE_DRIVER && IsNosVehicle( GetPlayerVehicleID( playerid ) ) )
        {
            AddVehicleComponent( GetPlayerVehicleID( playerid ), 1010 );
        }
        return 1;
    }
    return 1;
}

IsNosVehicle( vehicleid )
{
    #define NO_NOS_VEHICLES 52
    new
        InvalidNosVehicles[ NO_NOS_VEHICLES ] =
        {
            581, 523, 462, 521, 463, 522, 461, 448, 468, 586, 417, 425, 469, 487, 512, 520, 563, 593,
            509, 481, 510, 472, 473, 493, 520, 595, 484, 430, 453, 432, 476, 497, 513, 533, 577,
            452, 446, 447, 454, 590, 569, 537, 538, 570, 449, 519, 460, 488, 511, 519, 548, 592
        }
    ;
    for( new i = 0; i < NO_NOS_VEHICLES; i ++ )
    {
        if( GetVehicleModel( vehicleid ) == InvalidNosVehicles[ i ] ) return false;
    }
    return true;
}
Everytime, you press ALT GR/LCTRL/NUM0 and you're driving, it gives you nos. Without pressing these buttons at all, I could only think a timer that it gives nitro, but I wouldn't recomment it.
I don't understand the second one.
maybe you could do it under OnPlayerUpdate? To check if a player is in a vehicle and each time he move's give's nos, Don't really know never play with give vehicle components xd.


Re: need help [Rep ++] - Jarnu - 11.12.2012

doing that thing in OnPlayerUpdate may lag server when there are many players, using OnPlayerStateChange with newstate = Driver will be good enough..


Re: need help [Rep ++] - Scott Zulkifli - 11.12.2012

tested