Admin Onduty Slap player if shoot! - 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: Admin Onduty Slap player if shoot! (
/showthread.php?tid=582531)
Admin Onduty Slap player if shoot! -
jamesmith12 - 21.07.2015
Hello guys . what code i gonna add if Player shoot the adminonduty then the player will automatically Slap then Text Will show on the player screen "Dont Shoot Admin On Duty"
Thank you! +1Rep
Re: Admin Onduty Slap player if shoot! -
thaKing - 21.07.2015
Okey, I saw already another user replayed. Yep, that will work.
[IGNORE]
Re: Admin Onduty Slap player if shoot! -
nezo2001 - 21.07.2015
on the top
PHP код:
new bool:onDuty[MAX_PLAYERS];
under duty command
PHP код:
onDuty[playerid] = true;
Under OnPlayerGiveDamage
PHP код:
if(onDuty[damageid] == true)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(playerid, x, y, z+10);
}
Re: Admin Onduty Slap player if shoot! -
Roberto80 - 21.07.2015
PHP код:
new bool:AdminDuty[MAX_PLAYERS]
public OnPlayerConnect(playerid)
{
AdminDuty[playeridp] = false;
}
CMD:aduty
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, RED,"*You are not allowed to use this command!");
new aName[24],string);
GetPlayerName(playerid, aName, 24);
format(string,50,"[Admin] %s(%i) Is Now On Admin Duty!",aName,playerid);
SendClientMessageToAll(blue,string);
AdminDuty[playerid] = true;
return 1;
}
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid, bodypart)
{
if(IsPlayerAdmin(damagedid) && AdminDuty[damagedid] == true)
{
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid, X, Y, Z);
SetPlayerPos(playerid, X, Y, Z+1);
SendClientMessage(playerid,RED,"[Server]You Have Been Automatically Slapped To Shooting A Admin On Duty!");
SetPlayerHealth(damagedid,GetPlayerHealth(damagedid)+amount);
return 1;
}
Enjoy ^^