pawn Код:
new Float:CarHealth[MAX_PLAYERS];
public OnPlayerUpdate(playerid)
{
if(IsPlayerInAnyVehicle(playerid) == 1 && SeatBelt[playerid] == 0)
{
new Float:TempCarHealth;
GetVehicleHealth(GetPlayerVehicleID(playerid), TempCarHealth);
new Float:Difference = floatsub(CarHealth[playerid], TempCarHealth);
if((floatcmp(CarHealth[playerid], TempCarHealth) == 1) && (floatcmp(Difference,100.0) == 1))
{
Difference = floatdiv(Difference, 10.0);
new Float:OldHealth;
GetPlayerHealth(playerid, OldHealth);
SetPlayerHealth(playerid, floatsub(OldHealth, Difference));
}
CarHealth[playerid] = TempCarHealth;
}
else
{
CarHealth[playerid] = 0.0;
}
SetPlayerScore(playerid, GetPlayerMoney(playerid));
if(Masked[playerid] == 1) // This might cause lag cuz function is called many times but I think it won't cause it on our server
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(playerid))
{
ShowPlayerNameTagForPlayer(i, playerid, 0); // Showing player's tag for other player
}
}
return 1;
}
/*if(GetPlayerWeapon(playerid) == 16){ if(GetPlayerAmmo(playerid) >= 2){ SetPlayerAmmo(playerid, 16, 2); } }
if(GetPlayerWeapon(playerid) == 17){ if(GetPlayerAmmo(playerid) >= 6){ SetPlayerAmmo(playerid, 17, 6); } }
if(GetPlayerWeapon(playerid) == 18){ if(GetPlayerAmmo(playerid) >= 4){ SetPlayerAmmo(playerid, 18, 4); } }
if(GetPlayerWeapon(playerid) == 22){ if(GetPlayerAmmo(playerid) >= 170){ SetPlayerAmmo(playerid, 22, 170); } }
if(GetPlayerWeapon(playerid) == 23){ if(GetPlayerAmmo(playerid) >= 170){ SetPlayerAmmo(playerid, 23, 170); } }
if(GetPlayerWeapon(playerid) == 24){ if(GetPlayerAmmo(playerid) >= 70){ SetPlayerAmmo(playerid, 24, 70); } }
if(GetPlayerWeapon(playerid) == 25){ if(GetPlayerAmmo(playerid) >= 70){ SetPlayerAmmo(playerid, 25, 70); } }
if(GetPlayerWeapon(playerid) == 26){ if(GetPlayerAmmo(playerid) >= 20){ SetPlayerAmmo(playerid, 26, 20); } }
if(GetPlayerWeapon(playerid) == 27){ if(GetPlayerAmmo(playerid) >= 70){ SetPlayerAmmo(playerid, 27, 70); } }
if(GetPlayerWeapon(playerid) == 28){ if(GetPlayerAmmo(playerid) >= 500){ SetPlayerAmmo(playerid, 28, 500); } }
if(GetPlayerWeapon(playerid) == 29){ if(GetPlayerAmmo(playerid) >= 300){ SetPlayerAmmo(playerid, 29, 300); } }
if(GetPlayerWeapon(playerid) == 30){ if(GetPlayerAmmo(playerid) >= 300){ SetPlayerAmmo(playerid, 30, 300); } }
if(GetPlayerWeapon(playerid) == 31){ if(GetPlayerAmmo(playerid) >= 500){ SetPlayerAmmo(playerid, 31, 500); } }
if(GetPlayerWeapon(playerid) == 32){ if(GetPlayerAmmo(playerid) >= 500){ SetPlayerAmmo(playerid, 32, 500); } }
if(GetPlayerWeapon(playerid) == 33){ if(GetPlayerAmmo(playerid) >= 100){ SetPlayerAmmo(playerid, 33, 100); } }
if(GetPlayerWeapon(playerid) == 34){ if(GetPlayerAmmo(playerid) >= 50){ SetPlayerAmmo(playerid, 34, 50); } }
if(GetPlayerWeapon(playerid) == 35){ if(GetPlayerAmmo(playerid) >= 4){ SetPlayerAmmo(playerid, 35, 4); } }
if(GetPlayerWeapon(playerid) == 36){ if(GetPlayerAmmo(playerid) >= 4){ SetPlayerAmmo(playerid, 36, 4); } }
if(GetPlayerWeapon(playerid) == 39){ if(GetPlayerAmmo(playerid) >= 2){ SetPlayerAmmo(playerid, 39, 2); } }
if(GetPlayerWeapon(playerid) == 41){ if(GetPlayerAmmo(playerid) >= 500){ SetPlayerAmmo(playerid, 41, 500); } }
if(GetPlayerWeapon(playerid) == 42){ if(GetPlayerAmmo(playerid) >= 500){ SetPlayerAmmo(playerid, 42, 500); } }
if(GetPlayerWeapon(playerid) == 43){ if(GetPlayerAmmo(playerid) >= 30){ SetPlayerAmmo(playerid, 43, 30); } }*/
// Biker Club Music
if(GetPlayerInterior(playerid) == 5) {
if(IsPlayerInRangeOfPoint(playerid,50.0,2338.9119,-1185.0635,1027.9766)) { // Bikers
if(!GetPVarInt(playerid,"Bikers")) {
SetPVarInt(playerid,"Bikers",1);
PlayAudioStreamForPlayer(playerid, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1290072",2338.9119,-1185.0635,1027.9766,50.0,true);
}
}
}
else {
if(GetPVarInt(playerid,"Bikers")) {
DeletePVar(playerid,"Bikers");
StopAudioStreamForPlayer(playerid);
}
}
// Don't allow weapons
if(PlayerInfo[playerid][Level] >= 1)
{ }
else
{
if( (GetPlayerWeapon(playerid) == 26) || (GetPlayerWeapon(playerid) == 27) || (GetPlayerWeapon(playerid) == 34) || (GetPlayerWeapon(playerid) == 35) || (GetPlayerWeapon(playerid) == 36) || (GetPlayerWeapon(playerid) == 37) || (GetPlayerWeapon(playerid) == 38))
{
new string[256];
new aName[MAX_PLAYER_NAME];
GetPlayerName(playerid, aName, sizeof(aName));
format(string, sizeof(string), "%s ID:%d was auto kicked. (Reason: Possible Weapon Cheat)", aName,playerid);
SendClientMessageToAll(0xFB0000FF, string); print(string);
SaveToFile("KickLog",string); Kick(playerid);
return 0;
}
}
if(noclipdata[playerid][cameramode] == CAMERA_MODE_FLY)
{
new keys,ud,lr;
GetPlayerKeys(playerid,keys,ud,lr);
if(noclipdata[playerid][mode] && (GetTickCount() - noclipdata[playerid][lastmove] > 100))
{
// If the last move was > 100ms ago, process moving the object the players camera is attached to
MoveCamera(playerid);
}
// Is the players current key state different than their last keystate?
if(noclipdata[playerid][udold] != ud || noclipdata[playerid][lrold] != lr)
{
if((noclipdata[playerid][udold] != 0 || noclipdata[playerid][lrold] != 0) && ud == 0 && lr == 0)
{ // All keys have been released, stop the object the camera is attached to and reset the acceleration multiplier
StopPlayerObject(playerid, noclipdata[playerid][flyobject]);
noclipdata[playerid][mode] = 0;
noclipdata[playerid][accelmul] = 0.0;
}
else
{ // Indicates a new key has been pressed
// Get the direction the player wants to move as indicated by the keys
noclipdata[playerid][mode] = GetMoveDirectionFromKeys(ud, lr);
// Process moving the object the players camera is attached to
MoveCamera(playerid);
}
}
noclipdata[playerid][udold] = ud; noclipdata[playerid][lrold] = lr; // Store current keys pressed for comparison next update
return 0;
}
return 1;
}