16.08.2016, 09:10
(
Последний раз редактировалось MerryDeer; 21.08.2016 в 13:20.
)
Hi,
I made a little protect of course post where is mistakes or buggs:
Somewhere in end of gamemode near other stocks:
If weapon fireable function:
In OnPlayerConnect
I made a little protect of course post where is mistakes or buggs:
Код:
new Currentweaponrealong[ MAX_PLAYERS ]; new bool:Isrealoding[ MAX_PLAYERS ]; new Printttime[ MAX_PLAYERS ]; public OnPlayerUpdate(playerid) { if(!IsPlayerConnected(playerid)) return 0; if(IsPlayerNPC(playerid)) return 1; if( GetPlayerWeaponState(playerid) == WEAPONSTATE_RELOADING ) { if( Isrealoding[ playerid ] == false ) { Printttime[ playerid ] = gettime( ); Isrealoding[ playerid ] = true; Currentweaponrealong[ playerid ] = GetPlayerWeapon( playerid ); } } else { if( Isrealoding[ playerid ] == true ) { if( IsWeaponFireable( Currentweaponrealong[ playerid ] ) ) { if( gettime( ) - Printttime[ playerid ] < 2 ) { DoActionsForSwitchWeapons( playerid ); } } Isrealoding[ playerid ] = false; } } }
Код:
new Warningsforswitchingsweapons[ MAX_PLAYERS ]; stock DoActionsForSwitchWeapons( playerid ) { if( GetPlayerWeapon( playerid ) != Currentweaponrealong[ playerid ] ) { new weapons[13][2]; new bool:IsThereThatweapon; for (new i = 0; i <= 12; i++) { GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]); if( weapons[i][0] == Currentweaponrealong[ playerid ] ) { IsThereThatweapon = true; } } if( IsThereThatweapon == true ) { SetPlayerArmedWeapon( playerid, Currentweaponrealong[ playerid ] ); if( GetPlayerWeapon( playerid ) != Currentweaponrealong[ playerid ] ) { Kick( playerid ); } else { SendClientMessage( playerid, COLOR_RED,"* Please do not change your weapons when realoding! Otherwise you will by kicked"); Warningsforswitchingsweapons[ playerid ] ++; if( Warningsforswitchingsweapons[ playerid ] >= 10 ) { Kick( playerid ); } } } } }
Код:
stock IsWeaponFireable(weaponid) { switch (weaponid) { case 0..15, 40, 44..46: return false; } return true; }
Код:
Currentweaponrealong[ playerid ] = 0; Isrealoding[ playerid ] = false;