need help [Rep ++]
#1

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

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

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

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

tested
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)