[FilterScript] [fs] drive by.
#1

Oke, with this filterscript bug with shooting from car with pistols fixed: when you shoot with any pistol server freezes you for 2 second. Non tested, srry.

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if( newkeys == KEY_FIRE )
    {
        if( IsPlayerInAnyVehicle( playerid ) && GetPlayerState( playerid ) == PLAYER_STATE_PASSEENGER )
        {
            if( GetPlayerWeapon( playerid ) == 24 || GetPlayerWeapon( playerid ) == 23 || GetPlayerWeapon( playerid ) == 22 )
            {
                if( GetPVarInt( playerid, "Freezed" ) == 0 )
                {
                    SetTimerEx( "Unfreeze", 2000, false, "d", playerid );
                    TogglePlayerControllable( playerid, false );
                    SetPVarInt( playerid, "Freezed", 1 );
                }
            }
        }
    }
    return 1;
}
forward Unfreeze( playerid );
public Unfreeze( playerid )
{
    TogglePlayerContrllable( playerid, false );
    SetPVarInt( playerid, "Freezed", 0 );
    return true;
}

sorry for bad tab, forum fail.
Reply
#2

Frozen, not Freezed.
Reply
#3

oh srry.. ;s
Reply
#4

It's fine, I just thought I'd help your grammar
Reply
#5

Nice made man - But a tip. I've ever read that it is 'newkeys & {key}' instead of 'newkeys == {key}'. Read: https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange
Reply
#6

Quote:
Originally Posted by Kwarde
Посмотреть сообщение
Nice made man - But a tip. I've ever read that it is 'newkeys & {key}' instead of 'newkeys == {key}'. Read: https://sampwiki.blast.hk/wiki/OnPlayerKeyStateChange
Well, both work. Its just dramatically incorrect.
Reply
#7

bEFORE:
pawn Код:
PASSEENGER
After
pawn Код:
GetPlayerState( playerid ) == PLAYER_STATE_PASSENGER

pawn Код:
public Unfreeze( playerid )
{
    TogglePlayerContrllable( playerid, false );
    SetPVarInt( playerid, "Freezed", 0 );
    return true;
}
After:
pawn Код:
public Unfreeze( playerid )
{
    TogglePlayerControllable( playerid, false );
    SetPVarInt( playerid, "Freezed", 0 );
    return true;
}

@
Thanks.!
Reply
#8

So, this will actually freeze a player, will it affect, so player won't be able to move camera while frozen?
Reply
#9

Nice FS. Gonna use the code.
Reply
#10

Nice and useful. I'm gonna use it.
Reply
#11

Quote:
Originally Posted by Mean
Посмотреть сообщение
So, this will actually freeze a player, will it affect, so player won't be able to move camera while frozen?
Use:
pawn Код:
forward Unfreeze( playerid );
public Unfreeze( playerid )
{
    TogglePlayerContrallable( playerid, true );
    SetPVarInt( playerid, "Freezed", 0 );
    return true;
}
Reply
#12

I teste and this don't work.
: (((((((((((((((((((((((((
Reply
#13

Quote:
Originally Posted by Ricop522
Посмотреть сообщение
I teste and this don't work.
: (((((((((((((((((((((((((
well, get in some car. press h. shoot will deagle, and server will freeze you for 2secs.
Reply
#14

Gh0sT_ about the {key} == {key} and {key} & {key} : The '&' looks more professional xD
And another tip, instead of freezing 2 seconds, you can set armed weapon to 0, and after 2 seconds, you give it back - It's just a tip.
Reply
#15

Thanks for idea Kwarde!

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if( newkeys & KEY_FIRE )
    {
        if( IsPlayerInAnyVehicle( playerid ) && GetPlayerState( playerid ) == PLAYER_STATE_PASSEENGER )
        {
            if( GetPlayerWeapon( playerid ) == 24 || GetPlayerWeapon( playerid ) == 23 || GetPlayerWeapon( playerid ) == 22 )
            {
                if( GetPVarInt( playerid, "Freezed" ) == 0 )
                {
                    SetTimerEx( "Unfreeze", 2000, false, "d", playerid );
                    SetPVarInt( playerid, "Weapon", GetPlayerWeapon( playerid ) );
                    SetPVarInt( playerid, "Freezed", 1 );
                    SetPlayerArmedWeapon( playerid, 0 );
                }
            }
        }
    }
    return 1;
}
forward Unfreeze( playerid );
public Unfreeze( playerid )
{
    SetPlayerArmedWeapon( playerid, GetPVarInt( playerid, "Weapon" ) );
    SetPVarInt( playerid, "Freezed", 0 );
    return true;
}

no freeze, just setplayerarmedweapon. || > &
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)