Jump to content

[TUTORIAL] Cum sa protejezi o categorie de playeri


Yamato

Recommended Posts

Salutare , astazi m-am decis sa fac un tutorial despre cum se poate proteja o anumita categorie de playeri. Spre exemplu eu sunt admin si sunt absolut normal pe server , dar cand dau /aod, pot fii omorat sau diverse chestii deranjante . Astazi o sa invatam daca un player admin este on duty , si cineva il ataca , sa i se scada HP si sa i se dea slap.

 

Mergem la public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid) si adaugam asta:

 

if(AdminDuty[damagedid] == 1) //verificam daca playerul atacat este admin on duty
{
	new Float:plx, Float:ply, Float:plz; //definim plx, ply, plz
	GetPlayerPos(playerid, plx, ply, plz); //luam coordonatele adminului
	SetPlayerPos(playerid, plx, ply, plz+3); //setam coordonata z a atacatorului cu +3 (ii dam slap)
	new Float:playerHealth = 0; //definim playerhealth
    GetPlayerHealth ( playerid, playerHealth ); //luam health playerului actual 
    SetPlayerHealth(playerid, ( playerHealth - 20 ) ); //setam sa i se scada din health actual al playerului -20. 
    SendClientMessage(playerid, COLOR_LIGHTBLUE, "Acest player este On-Duty"); // trimitem mesaj atacatorului
    SendClientMessage(playerid, 0xFFFFFFFF, "Ti-a scazut viata pentru ca ai atacat un player On-Duty!"); //trimitem mesaj atacatorului
}

 

in final public-ul arata asa 

public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid)
{
	if(AdminDuty[damagedid] == 1)
    {
		new Float:plx, Float:ply, Float:plz;
	 	GetPlayerPos(playerid, plx, ply, plz);
	 	SetPlayerPos(playerid, plx, ply, plz+3);
	 	new Float:playerHealth = 0;
     	GetPlayerHealth ( playerid, playerHealth );
     	SetPlayerHealth(playerid, ( playerHealth - 20 ) );
     	SendClientMessage(playerid, COLOR_LIGHTBLUE, "Acest player este On-Duty");
     	SendClientMessage(playerid, 0xFFFFFFFF, "Ti-a scazut viata pentru ca ai atacat un player On-Duty!");
  	}
    return 1;
}

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.