[HELP] Anti Admin Aim - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [HELP] Anti Admin Aim (
/showthread.php?tid=595418)
[HELP] Anti Admin Aim -
Hayden_Almeida - 02.12.2015
Hello guys, i am trying to make somethink like: when one player aim at one Administrator, he will receive one Warning and change his weapon to fists.
I write this but does not work.
Код:
if((newkeys & KEY_HANDBRAKE) && !(oldkeys & KEY_HANDBRAKE)) // Botгo RMB (foot)
{
new targetplayer = GetPlayerTargetPlayer(playerid);
if(AdminTrabalhando[targetplayer] == true && targetplayer != INVALID_PLAYER_ID)
{
if(GetPlayerWeapon(playerid) > 0)
{
SetPlayerArmedWeapon(playerid, 0);
GameTextForPlayer(playerid, "~r~admin", 2000, 0);
}
}
return 1;
}
Re: [HELP] Anti Admin Aim -
PinkFloydLover - 02.12.2015
You need to find out why it's not working, add some prints, get the values & see if they are correct.
pawn Код:
if((newkeys & KEY_HANDBRAKE) && !(oldkeys & KEY_HANDBRAKE)) // Botгo RMB (foot)
{
new targetplayer = GetPlayerTargetPlayer(playerid);
printf("targetplayer: %d", targetplayer);
if(AdminTrabalhando[targetplayer] == true && targetplayer != INVALID_PLAYER_ID)
{
if(GetPlayerWeapon(playerid) > 0)
{
SetPlayerArmedWeapon(playerid, 0);
GameTextForPlayer(playerid, "~r~admin", 2000, 0);
}
}
return 1;
}
Re: [HELP] Anti Admin Aim -
Jefff - 03.12.2015
https://sampwiki.blast.hk/wiki/GetPlayerTargetPlayer
pawn Код:
public OnPlayerUpdate(playerid)
{
if(AdminTrabalhando[playerid]) return 1;
static targetplayer;
targetplayer = GetPlayerTargetPlayer(playerid);
if(targetplayer != INVALID_PLAYER_ID && AdminTrabalhando[targetplayer])
{
if(GetPlayerWeapon(playerid) > 0)
{
SetPlayerArmedWeapon(playerid, 0);
GameTextForPlayer(playerid, "~r~admin", 2000, 0);
}
}
return 1;
}
Re: [HELP] Anti Admin Aim -
Hayden_Almeida - 03.12.2015
Quote:
Originally Posted by Jefff
https://sampwiki.blast.hk/wiki/GetPlayerTargetPlayer
pawn Код:
public OnPlayerUpdate(playerid) { if(AdminTrabalhando[playerid]) return 1;
static targetplayer; targetplayer = GetPlayerTargetPlayer(playerid); if(targetplayer != INVALID_PLAYER_ID && AdminTrabalhando[targetplayer]) { if(GetPlayerWeapon(playerid) > 0) { SetPlayerArmedWeapon(playerid, 0); GameTextForPlayer(playerid, "~r~admin", 2000, 0); } } return 1; }
|
it works. Thanks.