[TUT]Kako napraviti /aduty komandu


Započeo berroni.pwn, Avgust 26, 2016, 22:25:27 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.



  • Naziv tutorijala
Kako napraviti /aduty cmd
  • Detaljan opis tutorijala

1. Otvorite vas GM
2. Na vrhu skripte dodajte
#define COLOR_DRED 0xFF0000AA //definira crvenu boju
new aDuty[MAX_PLAYERS];

3. Ispod OnPlayerConnect dodajte:
aDuty[playerid] = 0; //Postavlja igraca off duty kada udje na srw

4. Ispod OnPlayerDisconnect dodajte:
aDuty[playerid] = 0; //Postavlja off duty kada izadje

5. Dodajte ovo ondje gdje dodajete vase komande:
CMD:aduty(playerid) 
{
	if(PlayerInfo[playerid][pAdmin] >=1 || IsPlayerAdmin(playerid)) //Ako koristite RCON admina obrisite (PlayerInfo[playerid][pAdmin] >=1 || 
	{
		if (aDuty[playerid] == 0) //Check if player is on duty
		{
			new string[128];
			new Float:x,Float:y,Float:z;
			new Text3D:label = Create3DTextLabel("Admin On Duty!", COLOR_DRED,x,y,z, 40.0, 0, 0); //Creates 3d text label at player position
			GetPlayerPos(playerid,x,y,z); //Trazi pozicije igraca
			SetPlayerHealth(playerid,999999); //Daje godmode igracu[ne moze ga niko raniti]
			SetPlayerColor(playerid,COLOR_DRED); //Postavlja crvenu admin boju
			SetPlayerSkin(playerid,294); //Postavlja admin skin na 294
			format(string,sizeof(string), "%s je sada na duznosti!",GetPlayerNameEx(playerid)); //Postavljate koju poruku da igraci dobiju
			SendClientMessageToAll(COLOR_DRED,string); //Salje poruku igracima
			SendClientMessage(playerid,COLOR_DRED,"Ti si sada na duznosti!"); 
			Attach3DTextLabelToPlayer(label,playerid,0.0, 0.0, 0.7);
			aDuty[playerid] = 1; //Daje igracu duznost
		}
		else if (aDuty[playerid] == 1) //Provjerava da li je igrac na duznosti
		{
  			new string[128];
  			new Float:x,Float:y,Float:z;
  			new Text3D:label = Create3DTextLabel("Admin na duznosti!", COLOR_DRED,x,y,z, 40.0, 0, 0);
  			Delete3DTextLabel(label); 
     		SetPlayerHealth(playerid,100); //Vraca HP nazad na 100
			format(string,sizeof(string)," %s je sada van duznosti!",GetPlayerNameEx(playerid)); //Pisite koju poruku da igraci dobiju kada admin skine duznost
			SendClientMessageToAll(COLOR_DRED,string); //Salje igracima tu poruku
			SendClientMessage(playerid, COLOR_DRED,"Admin je sada van duznosti!"); //Salje poruku
			aDuty[playerid] = 0; //Skida duznost adminu
		}
 	}
	else
		SendClientMessage(playerid,COLOR_DRED,"Niste ovlasteni!"); //Error poruka koju salje igracima koji nisu admini
	return 1;
}




ZA POCETNIKE !

Credits:
Audi_Quattrix

[/font]


Posluzit ce nekom ...

Nova Kuca Community - Founder , Owner

Moglo je to na mnogo laksi i kraci nacin ali eto posluzit ce nekom
• G A M E M O D E •
• F I L T E R S C R I P T •
• T U T O R I A L •


Citat
You are what you believe yoursefl to be.