24.12.2010, 11:11
Jo!
I was bored, so I decided to make an anti-fight script :P - It's for servers/places where you may not fight.
You can edit it, for jail or something. Whatever it does do this:
* When you have any weapon, it will be removed (all the weapons).
* When you press KEY_FIRE, you'll be frozen and you'll get a msg. After 3 secs, unfrozen
* If you press KEY_AIM and KEY_SECONDARY_ATTACK you'll get the same as KEY_FIRE (example: Holding RMB then tap ENTER)
It's small, easy, but it works.
Here goes the code. I don't need any credits. It took me about 30 seconds :')
I was bored, so I decided to make an anti-fight script :P - It's for servers/places where you may not fight.
You can edit it, for jail or something. Whatever it does do this:
* When you have any weapon, it will be removed (all the weapons).
* When you press KEY_FIRE, you'll be frozen and you'll get a msg. After 3 secs, unfrozen
* If you press KEY_AIM and KEY_SECONDARY_ATTACK you'll get the same as KEY_FIRE (example: Holding RMB then tap ENTER)
It's small, easy, but it works.
Here goes the code. I don't need any credits. It took me about 30 seconds :')
pawn Код:
#include <a_samp>
#define KEY_AIM 128
forward UnfreezePlayer(playerid);
public OnFilterScriptInit() return 1;
public OnFilterScriptExit() return 1;
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if( (newkeys & KEY_FIRE) || ( (newkeys & KEY_AIM) && (oldkeys & KEY_AIM) && (newkeys & KEY_SECONDARY_ATTACK) ) )
{
SendClientMessage(playerid, 0xFFFFFFAA, "SERVER: Don't fight here!");
TogglePlayerControllable(playerid, false);
SetTimerEx("UnfreezePlayer", 3000, false, "i", playerid);
return 1;
}
return 1;
}
public OnPlayerUpdate(playerid)
if(GetPlayerWeapon(playerid) != 0)
SendClientMessage(playerid, 0xFFFFFFAA, "SERVER: No weapons here!"), ResetPlayerWeapons(playerid);
public UnfreezePlayer(playerid)
return TogglePlayerControllable(playerid, true);