SA-MP Forums Archive
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:xFloat:yFloat:z;
    
GetPlayerPos(playeridxyz);
    
SetPlayerPos(playeridxyz+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(playeridRED,"*You are not allowed to use this command!");
new 
aName[24],string);
GetPlayerName(playeridaName24);
format(string,50,"[Admin] %s(%i) Is Now On Admin Duty!",aName,playerid);
SendClientMessageToAll(blue,string);
AdminDuty[playerid] = true;
return 
1;
}
public 
OnPlayerGiveDamage(playeriddamagedidFloatamountweaponidbodypart)
{
if(
IsPlayerAdmin(damagedid) && AdminDuty[damagedid] == true)
{
new 
Float:X,Float:Y,Float:Z;
GetPlayerPos(playeridXYZ);
SetPlayerPos(playeridXYZ+1);
SendClientMessage(playerid,RED,"[Server]You Have Been Automatically Slapped To Shooting A Admin On Duty!");
SetPlayerHealth(damagedid,GetPlayerHealth(damagedid)+amount);
return 
1;

Enjoy ^^