22.07.2012, 16:21
Untested but better than OP
pawn Код:
#include <a_samp>
#include <zcmd>
#define KICK_GUN 38
new bool:HasKickGun[MAX_PLAYERS];
stock TogglePlayerKickGun(playerid, toggle)
{
switch(toggle)
{
case 0:
{
new gun, ammo;
new GunArray[13][2];
for(new i=0; i<13; i++)
{
GetPlayerWeaponData(playerid, i, gun, ammo);
GunArray[i][0] = gun;
GunArray[i][1] = ammo;
}
ResetPlayerWeapons(playerid);
for(new i=0; i<13; i++)
{
if(GunArray[i][0] != KICK_GUN)
{
GivePlayerWeapon(playerid, GunArray[i][0], GunArray[i][0]);
}
}
SendClientMessage(damagedid, 0xFFFFFFFF, ">> KickGun DISABLED");
HasKickGun[playerid] = false;
}
case 1:
{
GivePlayerWeapon(playerid, KICK_GUN, 35525);
SendClientMessage(damagedid, 0xFFFFFFFF, ">> KickGun ENABLED");
HasKickGun[playerid] = true;
}
}
}
public OnPlayerConnect(playerid)
{
HasKickGun[playerid] = false;
return 1;
}
public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid)
{
if(HasKickGun[playerid] && weaponid == KICK_GUN)
{
SendClientMessage(damagedid, 0xFFFFFFFF, ">> You were kicked by the kickgun");
Kick(damagedid);
}
return 1;
}
CMD:KickGun(playerid, params[])
{
if(IsPlayerAdmin(playerid))
{
if(HasKickGun[playerid])
{
TogglePlayerKickGun(playerid, 0);
}
else
{
TogglePlayerKickGun(playerid, 1);
}
}
else
{
SendClientMessage(damagedid, 0xFFFFFFFF, ">> No KickGun for you!");
}
return 1;
}