07.02.2010, 15:55
Any way to optimize this code?
pawn Код:
public OnPlayerUpdate(playerid)
{
if(GetPlayerWeapon(playerid) == WEAPON_MINIGUN)
{
Punishplayer(playerid, "Weapon Cheat Minigun",3,1);
return 0;
}
if(GetPlayerWeapon(playerid) == WEAPON_HEATSEEKER)
{
Punishplayer(playerid, "Weapon Cheat RPG",3,1);
return 0;
}
if(GetPlayerWeapon(playerid) == WEAPON_ROCKETLAUNCHER)
{
Punishplayer(playerid, "Weapon Cheat Rocket Launcer",3,1);
return 0;
}
if(GetPlayerWeapon(playerid) == WEAPON_CAMERA)
{
Punishplayer(playerid, "Weapon Cheat Camera",3,1);
return 0;
}
if(GetPlayerWeapon(playerid) == 44)
{
Punishplayer(playerid, "Weapon Cheat Nightvision Goggles",3,1);
return 0;
}
if(GetPlayerWeapon(playerid) == 45)
{
Punishplayer(playerid, "Weapon Cheat Infrared Vision",3,1);
return 0;
}
if(GetPlayerWeapon(playerid) == WEAPON_BOMB)
{
Punishplayer(playerid, "Weapon Cheat Detonator",3,1);
return 0;
}
if(GetPlayerWeapon(playerid) == 44)
{
Punishplayer(playerid, "Weapon Cheat Nightvision Goggles",3,1);
return 0;
}
if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USEJETPACK)
{
Punishplayer(playerid, "Jetpack cheat",Jetpack_PUNISH,1);
}
new Float:VehHP;
new VID;
GetPlayerHealth(playerid,HP);
GetPlayerArmour(playerid,ARM);
VID = GetPlayerVehicleID(playerid);
GetVehicleHealth(VID,VehHP);
if(HP > 100)
{
Punishplayer(playerid, "Godmod",godmod_PUNISH,1);
}
if(ARM > 100)
{
Punishplayer(playerid, "Armour Hack",godmod_PUNISH,1);
}
if(VehHP >= 1001 && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
Punishplayer(playerid, "Car Godmode",cargodmod_PUNISH,1);
}
return 1;
}