Код HTML:
public OnPlayerUpdate(playerid)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(IsADmvCar(vehicleid))
{
new Float:vhp;
GetVehicleHealth(vehicleid,vhp);
if(vhp < 600)
{
SetVehicleToRespawn(vehicleid);
RemovePlayerFromVehicle(playerid);
TakingLesson[playerid] = 0;
DisablePlayerRaceCheckpoint(playerid);
}
}
new drunk2 = GetPlayerDrunkLevel(playerid);
if(drunk2 < 100)
{
SetPlayerDrunkLevel(playerid,2000);
}
else
{
if(DLlast[playerid] != drunk2)
{
new fps = DLlast[playerid] - drunk2;
if((fps > 0) && (fps < 200))
FPS2[playerid] = fps;
DLlast[playerid] = drunk2;
}
}
if(GetPlayerVehicleID(playerid) != 0 )
{
if(GetPlayerVehicleID(playerid) != GetPVarInt(playerid, "Vehicle_ID"))
{
if(GetPVarInt(playerid, "Vehicle_Time") > gettime()) return Kick(playerid);
SetPVarInt(playerid, "Vehicle_ID", GetPlayerVehicleID(playerid));
SetPVarInt(playerid, "Vehicle_Time", gettime() + 2);
}
}
if (GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
{
new Float:vec[3];
GetPlayerCameraFrontVector(playerid, vec[0], vec[1], vec[2]);
new bool:possible_crasher = false;
for (new i = 0; !possible_crasher && i < sizeof(vec); i++)
if (floatabs(vec[i]) > 10.0)
possible_crasher = true;
if (possible_crasher)
return 0; //do not send fake data, prevents crash
}
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER && Speedlimit[playerid])
{
new a, b, c;
GetPlayerKeys(playerid, a, b ,c);
if(a == 8 && GetVehicleSpeed(GetPlayerVehicleID(playerid), 0) > Speedlimit[playerid])
{
new newspeed = GetVehicleSpeed(GetPlayerVehicleID(playerid), 0) - Speedlimit[playerid];
ModifyVehicleSpeed(GetPlayerVehicleID(playerid), -newspeed);
}
}
new
iTick = GetTickCount( ),
iAnimationIndex = GetPlayerAnimationIndex( playerid ),
iWeapon = GetPlayerWeapon( playerid ),
iKeys,
iKeysUD,
iKeysLR
;
GetPlayerKeys( playerid, iKeys, iKeysUD, iKeysLR );
if ( ( iKeys & KEY_FIRE ) || ( ( iKeys & KEY_ACTION ) && ( iKeys & KEY_AIM ) ) )
{
CBugPlayerInfo[ playerid ][ iLastFire ] = iTick;
if ( !CBugPlayerInfo[ playerid ][ isFiring ] )
{
CBugPlayerInfo[ playerid ][ isFiring ] = true;
CBugPlayerInfo[ playerid ][ iLastFiring ] = iTick;
}
}
else if ( CBugPlayerInfo[ playerid ][ isFiring ] )
CBugPlayerInfo[ playerid ][ isFiring ] = false;
switch ( iAnimationIndex )
{
case 1274: // WEAPON_CROUCH
{
if ( !CBugPlayerInfo[ playerid ][ isCrouched ] )
{
CBugPlayerInfo[ playerid ][ isCrouched ] = true;
CBugPlayerInfo[ playerid ][ iCrouchTime ] = iTick;
}
if ( iWeapon && ( iKeys & KEY_FIRE ) && iTick - CBugPlayerInfo[ playerid ][ iCrouchTime ] > 300 )
ClearAnimations( playerid );
}
case 1160 .. 1163, 1167: // GUNMOVE_L/R/FWD/BWD, GUN_STAND
{
if ( ( iKeys & KEY_FIRE ) )
{
switch ( iWeapon )
{
case
WEAPON_SILENCED,
WEAPON_DEAGLE,
WEAPON_SHOTGUN,
WEAPON_SHOTGSPA,
WEAPON_MP5,
WEAPON_M4,
WEAPON_AK47,
WEAPON_RIFLE,
WEAPON_SNIPER:
{
CBugPlayerInfo[ playerid ][ iLastStrafeFire ] = iTick;
}
}
}
}
case
1231, // RUN_PLAYER
1223, // RUN_ARMED
1141, // FIGHTA_M
478, // FIGHTB_M
489, // FIGHTC_M
500, // FIGHTD_M
759, // KNIFE_PART
27, // BAT_PART
1554 // SWORD_PART
:
{
switch ( GetWeaponSlot( iWeapon ) )
{
case 0, 1, 8, 9, 10, 11, 12:
{
}
default:
{
if ( ( iKeys & KEY_AIM ) && ( iKeys & KEY_ACTION ) ) {
ClearAnimations( playerid );
return 2;
}
else if ( CBugPlayerInfo[ playerid ][ isFiring ] && iTick - CBugPlayerInfo[ playerid ][ iLastFiring ] > 150 ) {
ClearAnimations( playerid );
return 2;
}
}
}
}
}
if ( ( iKeys & KEY_CROUCH ) && iTick - CBugPlayerInfo[ playerid ][ iLastStrafeFire ] < 500 )
{
ClearAnimations( playerid );
ApplyAnimation( playerid, "PED", "XPRESSscratch", 0.0, 1, 0, 0, 0, 500 - ( iTick - CBugPlayerInfo[ playerid ][ iLastStrafeFire ] ), 1 );
return 2;
}
if ( CBugPlayerInfo[ playerid ][ isCrouched ] && iAnimationIndex != 1274 ) // WEAPON_CROUCH
CBugPlayerInfo[ playerid ][ isCrouched ] = false;
if(GetPlayerSurfingVehicleID(playerid) != INVALID_VEHICLE_ID && GetPlayerWeapon(playerid) != 0)
{
new Float: slx, Float: sly, Float:slz;
GetPlayerPos(playerid, slx, sly, slz);
SetPlayerPosEx(playerid, slx, sly, slz+5);
SetPlayerArmedWeapon(playerid,0);
}
return 1;
}