Archived

This topic is now archived and is closed to further replies.

Haligut

[Tutorial/SA:MP] Comenzi pentru GF

22 posts in this topic

La new definim:

 

new gNewb[MAX_PLAYERS];

 

La OnPlayerConnect(playerid); definim:

 

gNewb[playerid] = 0;

 

Comanda - /newbie:

 

if(strcmp(cmd, "/newbie", true) == 0 || strcmp(cmd, "/n", true) == 0)
{
	if(IsPlayerConnected(playerid))
	{
	if(PlayerInfo[playerid][pLevel] > 4)
		{
			SendClientMessage(playerid, COLOR_GREY, "Level-ul tau este deja mare, nu mai esti un newbie.");
			return 1;
		}
		GetPlayerName(playerid, sendername, sizeof(sendername));
		new length = strlen(cmdtext);
		while ((idx < length) && (cmdtext[idx] <= ' '))
		{
			idx++;
		}
		new offset = idx;
		new result[64];
		while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
		{
			result[idx - offset] = cmdtext[idx];
			idx++;
		}

		result[idx - offset] = EOS;
		if(!strlen(result))
		{
			SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/n)ewbchat [text]");
			return 1;
		}

		if(gPlayerLogged[playerid] == 0)
		{
			SendClientMessage(playerid, COLOR_GREY, "   You havent logged in yet !");
			return 1;
		}

		if(PlayerInfo[playerid][pMuted] == 1)
		{
			SendClientMessage(playerid, TEAM_CYAN_COLOR, "   You can't speak, you have been silenced !");
			return 1;
		}

		if(gNewb[playerid] == 0)
		{	  
			if (PlayerInfo[playerid][pHelper] < 1)
						   {
								  format(string, sizeof(string), "(N) Newbie Level %d %s: %s", PlayerInfo[playerid][pLevel], sendername, result);
						   }
						  else
						  {
								 format(string, sizeof(string), "(N) Helper Level %d %s: %s", PlayerInfo[playerid][pHelper], sendername, result);
						  }
						  if (PlayerInfo[playerid][pAdmin] >= 1)
						  {
								 format(string, sizeof(string), "(N) Admin Level %d %s: %s", PlayerInfo[playerid][pAdmin], sendername, result);
						  }

			for(new i = 0; i < MAX_PLAYERS; i++)
			{
				if(IsPlayerConnected(i))
				{
					if(PlayerInfo[i][pLevel] <= 4 || PlayerInfo[i][pAdmin] > 0 || gNewb[i] == 0)
					{
						SendClientMessage(i, 0x629B37FF, string);
					}
				}
			}
			printf("%s", string);
			return 1;
		}
		  else
		{
			SendClientMessage(playerid, COLOR_GRAD2, "   You must toggle that Channel to On! (/tognewb)");
			return 1;
		}
	}
	return 1;
}

 

Comanda - /tognewb:

 

	if(strcmp(cmd, "/tognewb", true) == 0)
{
	if(IsPlayerConnected(playerid))
	{
		if (gNewb[playerid] == 0)
		{
			gNewb[playerid] = 1;
			SendClientMessage(playerid, COLOR_GRAD2, "  Newbie chat channel deactivated !");
		}
		else if (gNewb[playerid] == 1)
		{
			gNewb[playerid] = 0;
			SendClientMessage(playerid, COLOR_GRAD2, "  Newbie chat channel activated !");
		}
	}
	return 1;
}

Am inlocuit cu comanda din tutorialul lui Danilicious, numai ca am modificat putin. Daca aveti probleme postati aici.

Share this post


Link to post
Share on other sites
//----------------------------------[Newbie]-----------------------------------------------
if(strcmp(cmd, "/newbie", true) == 0 || strcmp(cmd, "/n", true) == 0)
{
	if(IsPlayerConnected(playerid))
	{
		if(gPlayerLogged[playerid] == 0)
		{
			SendClientMessage(playerid, COLOR_GREY, "You haven't logged in yet!");
			return 1;
		}
		if(PlayerInfo[playerid][pLevel] < 4 || PlayerInfo[playerid][pAdmin] >=1 || PlayerInfo[playerid][pHelper] >= 1)
		{ }
		else
		{
			SendClientMessage(playerid, COLOR_GRAD2, "Nu mai esti newbie, level-ul tau e deja mare!");
			return 1;
		}
		if(PlayerInfo[playerid][pMuted] == 1)
		{
			SendClientMessage(playerid, TEAM_CYAN_COLOR, "You have been silenced!");
			return 1;
		}
		GetPlayerName(playerid, sendername, sizeof(sendername));
		new length = strlen(cmdtext);
		while ((idx < length) && (cmdtext[idx] <= ' '))
		{
			idx++;
		}
		new offset = idx;
		new result[64];
		while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
		{
			result[idx - offset] = cmdtext[idx];
			idx++;
		}
		result[idx - offset] = EOS;
		result[0] = toupper(result[0]);
		if(!strlen(result))
		{
			SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /n [text]");
			return 1;
		}
		if (PlayerInfo[playerid][pHelper] < 1)
		{
			format(string, sizeof(string), "(N) Newbie Level %d %s: %s", PlayerInfo[playerid][pLevel], sendername, result);
		}
		else
		{
			format(string, sizeof(string), "(N) Helper Level %d %s: %s", PlayerInfo[playerid][pHelper], sendername, result);
		}
		if (PlayerInfo[playerid][pAdmin] >= 1)
		{
			format(string, sizeof(string), "(N) Admin %d %s: %s", PlayerInfo[playerid][pAdmin], sendername, result);
		}
		for (new n=0; n<MAX_PLAYERS; n++)
		{
			if (IsPlayerConnected(n) && (PlayerInfo[n][pLevel] < 3 || PlayerInfo[n][pHelper] > 0))
			{
				SendClientMessageToAll(COLOR_LIGHTGREEN, string);
			}
		}
		printf("%s", string);
	}
	return 1;
}

Tot ce trebuie sa faceti este sa adaugati aceasta comanda in gamemode, eu am adaugat-o sub /shout, daca aveti helper pe server e ok, daca nu trebuie sa stergeti tot ce contine helper din aceasta comanda, in momentul in care folosesti /n, orice ai scrie va fi scris cu litera mare (initiala). Daca aveti probleme/erori postati-le, sper ca va este de folos.

 

Este bună comanda , dar pentru lideri tot Newbie va scrie ?

Era mai bine să adaugi :

if (PlayerInfo[playerid][pLeader] < 1)
		{
			format(string, sizeof(string), "(N) Leader %d %s: %s", PlayerInfo[playerid][pLevel], sendername, result);
		}

 

S-au să faci la fiecare facţiune cu numele ei

Share this post


Link to post
Share on other sites

Vrei sa spui

if (PlayerInfo[playerid][pLeader] > 1)

 

Nu

 

if (PlayerInfo[playerid][pLeader] < 1)

Share this post


Link to post
Share on other sites
Vrei sa spui

if (PlayerInfo[playerid][pLeader] > 1)

 

Nu

 

if (PlayerInfo[playerid][pLeader] < 1)

 

 

Da scuze :)), a rămas semnul aşa.

Share this post


Link to post
Share on other sites

Descriere: Este o simpla comanda, ea este echivalenta a mesajului transmis prin consola cu "Say ...". Deci in joc vom scrie /am [text] si va aparea "ADMIN: ..." cu albastru.

Cautam

public OnPlayerCommandText(playerid, cmdtext[])

si sub celelalte comenzi de admin, spre exemplu sub comanda /o, adaugam

//------------------------------------------[special admin command]--------------------------
if(strcmp(cmd,"/am",true)==0)
{
	if (PlayerInfo[playerid][pAdmin] >= 1337)
	{

		GetPlayerName(playerid, sendername, sizeof(sendername));
		new length = strlen(cmdtext);
		while ((idx < length) && (cmdtext[idx] <= ' '))
		{
			idx++;
		}
		new offset = idx;
		new result[64];
		while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
		{
			result[idx - offset] = cmdtext[idx];
			idx++;
		}
		result[idx - offset] = EOS;
		result[0] = toupper(result[0]);
		if(!strlen(result))
		{
			SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/a)dmin(m)essage [message]");
			return 1;
		}
		format(string, sizeof(string), "ADMIN: %s", result);
		OOCOff(COLOR_LIGHTBLUE,string);
		printf("%s", string);
	}
	return 1;
}

 

Acum, ca sa apara comanda si cand dam /ahelp, cautam comanda

/ahelp

si la

Admin Level 1337 Commands *

adaugam

/am

si va arata cam asa

Admin Level 1337 Commands * /am (si aici celelalte comenzi pe care le are admin-ul)

PS. Daca nu am fost destul de explicit sau daca primiti o eroare, doar spuneti-mi aici.

Share this post


Link to post
Share on other sites

Descriere: Este o simpla comanda, ca si /f, cu care pot discuta Leaderii intre ei.

La

public OnPlayerCommandText(playerid, cmdtext[])

, sub orice comanda, adaugam

///----------------------------------[LeaderChat]-----------------------------------------------
if(strcmp(cmd, "/leaderchat", true) == 0 || strcmp(cmd, "/lc", true) == 0)
{
	if(IsPlayerConnected(playerid))
	{
		GetPlayerName(playerid, sendername, sizeof(sendername));
		new length = strlen(cmdtext);
		while ((idx < length) && (cmdtext[idx] <= ' '))
		{
			idx++;
		}
		new offset = idx;
		new result[64];
		while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
		{
			result[idx - offset] = cmdtext[idx];
			idx++;
		}
				new leaders = PlayerInfo[playerid][pLeader];
		result[idx - offset] = EOS;
		result[0] = toupper(result[0]);
		if(!strlen(result))
		{
			SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/l)aders(c)hat [Chat of leaders]");
			return 1;
					}
		else if(leaders==1)
		{
			format(string, sizeof(string), "[LEADER]Police Departament %s: %s.", sendername, result);
		}
		else if(leaders==2)
		{
			format(string, sizeof(string), "[LEADER]FBI %s: %s.", sendername, result);
		}
		else if(leaders==3)
		{
			format(string, sizeof(string), "[LEADER]National Guard %s: %s.", sendername, result);
		}
		else if(leaders==4)
		{
			format(string, sizeof(string), "[LEADER]Medic %s: %s.", sendername, result);
		}
		else if(leaders==5)
		{
			format(string, sizeof(string), "[LEADER]LCN %s: %s.", sendername, result);
		}
		else if(leaders==6)
		{
			format(string, sizeof(string), "[LEADER]Yakuza %s: %s.", sendername, result);
		}
		else if(leaders==7)
		{
			format(string, sizeof(string), "[LEADER]Mayor %s: %s.", sendername, result);
		}
		else if(leaders==8)
		{
			format(string, sizeof(string), "[LEADER]Hitman %s: %s.", sendername, result);
		}
		else if(leaders==9)
		{
			format(string, sizeof(string), "[LEADER]News Reporter %s: %s.", sendername, result);
		}
		else if(leaders==10)
		{
			format(string, sizeof(string), "[LEADER]Taxi Company %s: %s.", sendername, result);
		}
		else if(leaders==11)
		{
			format(string, sizeof(string), "[LEADER]School Instructor %s: %s.", sendername, result);
		}
		else if(leaders==12)
		{
			format(string, sizeof(string), "[LEADER]Bloods %s: %s.", sendername, result);
		}
		else if(leaders==13)
		{
			format(string, sizeof(string), "[LEADER]Crips %s: %s.", sendername, result);
		}
		else if(leaders==14)
		{
			format(string, sizeof(string), "[LEADER]Nortenos %s: %s.", sendername, result);
		}
		else if(leaders==15)
		{
			format(string, sizeof(string), "[LEADER]Surenos %s: %s.", sendername, result);
		}
		if (PlayerInfo[playerid][pLeader] >= 1)
		{
			SendLeaderMessage(COLOR_1GREEN, string);
		}
		printf("Leader %s: %s", sendername, result);
	}
	return 1;
}

, acum depinde si cum aveti voi structurate factiunile, daca le aveti altfel, pur si simplu schimbati id-ul si numele factiunii.

Sper sa va fie de folos.

PS. Daca nu am fost destul de explicit sau daca apar erori, spuneti-mi aici.

Share this post


Link to post
Share on other sites

Descriere: Ca si pe eGaming, este o comanda care "respawneaza" un player.

Cautam

public OnPlayerCommandText(playerid, cmdtext[])

si sub orice comanda de admin, adaugam

if(strcmp(cmd, "/respawn", true) == 0) 
{
	if(IsPlayerConnected(playerid))
	{
		tmp = strtok(cmdtext, idx);
		if(!strlen(tmp))
		{
			SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /respawn [playerid/PartOfName]");
			return 1;
		}
		new playa;
		  playa = ReturnUser(tmp);
		  if (PlayerInfo[playerid][pAdmin] >= 1)
		{
			if(IsPlayerConnected(playa))
			{
				if(playa != INVALID_PLAYER_ID)
				{
					  //if(SpawnChange[playerid])
					{
						GetPlayerName(playa, giveplayer, sizeof(giveplayer));
						SpawnPlayer(playa);
						GetPlayerName(playerid, sendername, sizeof(sendername));
						format(string, sizeof(string), "* You have respawned player %s.", giveplayer);
						SendClientMessage(playerid, COLOR_LIGHTRED, string);
 						format(string, sizeof(string), "* You have been respawned by Admin %s.", sendername);
						SendClientMessage(playa, COLOR_LIGHTRED, string);
						format(string, 256, "News: %s has respawned the player %s (/respawn).", sendername, giveplayer);
						ABroadCast(COLOR_YELLOW,string,1);
						return 1;
					}
				}
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GRAD1, " Nu ai voie sa folosesti aceasta comanda!");
		}
	}
	return 1;
}

Acum cautam

/ahelp

si la

Admin Level 1 *

adaugam

/respawn

si va arata cam asa:

Admin Level 1 * /respawn (si celelalte comenzi pe care le are admin-ul)

PS. Daca nu am fost destul de explicit sau aveti erori, spuneti aici.

Share this post


Link to post
Share on other sites

Descriere: Este o simpla comanda cu care un admin poate da licente.

Cautam

//---------public OnPlayerCommandText(playerid, cmdtext[])

si sub o oarecare comanda de admin adaugam

---------------------------------------[Admin Give License]-------------------------------------
if(strcmp(cmd, "/agivelicense", true) == 0 || strcmp(cmd, "/agl", true) == 0)
{
	if(IsPlayerConnected(playerid))
	{
		if (PlayerInfo[playerid][pAdmin] >= 3)
		{
			new x_nr[256];
			x_nr = strtok(cmdtext, idx);
			if(!strlen(x_nr)) {
				SendClientMessage(playerid, COLOR_WHITE, "USAGE: /agivelicense [name] [playerid/PartOfName]");
				SendClientMessage(playerid, COLOR_WHITE, "Available names: Driving, Pilots, Sailing, Fishing, Weapon.");
				return 1;
			}
			if(strcmp(x_nr,"driving",true) == 0)
			{
				tmp = strtok(cmdtext, idx);
				if(!strlen(tmp))
				{
					SendClientMessage(playerid, COLOR_WHITE, "USAGE: /agivelicense driverslicense [playerid/PartOfName]");
					return 1;
				}
				giveplayerid = ReturnUser(tmp);
				if(IsPlayerConnected(giveplayerid))
				{
					if(giveplayerid != INVALID_PLAYER_ID)
					{
						GetPlayerName(playerid, sendername, sizeof(sendername));
						GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
						format(string, sizeof(string), "* You've given a Drivers License to %s.",giveplayer);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "* Admin %s has given you a Drivers License.",sendername);
						SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
						PlayerInfo[giveplayerid][pCarLic] = 1;
						return 1;
					}
				}
				else
				{
					SendClientMessage(playerid, COLOR_GREY, "   That player is Offline!");
					return 1;
				}
			}
			else if(strcmp(x_nr,"Pilots",true) == 0)
			{
				tmp = strtok(cmdtext, idx);
				if(!strlen(tmp))
				{
					SendClientMessage(playerid, COLOR_WHITE, "USAGE: /agivelicense Pilotslicense [playerid/PartOfName]");
					return 1;
				}
				giveplayerid = ReturnUser(tmp);
				if(IsPlayerConnected(giveplayerid))
				{
					if(giveplayerid != INVALID_PLAYER_ID)
					{
						GetPlayerName(playerid, sendername, sizeof(sendername));
						GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
						format(string, sizeof(string), "* You've given a Pilots License to %s.",giveplayer);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "* Admin %s has given you a Pilots License.",sendername);
						SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
						PlayerInfo[giveplayerid][pFlyLic] = 1;
						return 1;
					}
				}
				else
				{
					SendClientMessage(playerid, COLOR_GREY, "   That player is Offline!");
					return 1;
				}
			}
			else if(strcmp(x_nr,"sailing",true) == 0)
			{
				tmp = strtok(cmdtext, idx);
				if(!strlen(tmp))
				{
					SendClientMessage(playerid, COLOR_WHITE, "USAGE: /agivelicense sailinglicense [playerid/PartOfName]");
					return 1;
				}
				giveplayerid = ReturnUser(tmp);
				if(IsPlayerConnected(giveplayerid))
				{
					if(giveplayerid != INVALID_PLAYER_ID)
					{
						GetPlayerName(playerid, sendername, sizeof(sendername));
						GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
						format(string, sizeof(string), "* You've given a Sailing License to %s.",giveplayer);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "* Admin %s has given you a Sailing License.",sendername);
						SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
						PlayerInfo[giveplayerid][pBoatLic] = 1;
						return 1;
					}
				}
				else
				{
					SendClientMessage(playerid, COLOR_GREY, "   That player is Offline!");
					return 1;
				}
			}
			else if(strcmp(x_nr,"fishing",true) == 0)
			{
				tmp = strtok(cmdtext, idx);
				if(!strlen(tmp))
				{
					SendClientMessage(playerid, COLOR_WHITE, "USAGE: /agivelicense fishinglicense [playerid/PartOfName]");
					return 1;
				}
				giveplayerid = ReturnUser(tmp);
				if(IsPlayerConnected(giveplayerid))
				{
					if(giveplayerid != INVALID_PLAYER_ID)
					{
						GetPlayerName(playerid, sendername, sizeof(sendername));
						GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
						format(string, sizeof(string), "* You've given a Fishing License to %s.",giveplayer);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "* Admin %s has given you a Fishing License.",sendername);
						SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
						PlayerInfo[giveplayerid][pFishLic] = 1;
						return 1;
					}
				}
				else
				{
					SendClientMessage(playerid, COLOR_GREY, "   That player is Offline!");
					return 1;
				}
			}
			else if(strcmp(x_nr,"weapon",true) == 0)
			{
				tmp = strtok(cmdtext, idx);
				if(!strlen(tmp))
				{
					SendClientMessage(playerid, COLOR_WHITE, "USAGE: /agivelicense weaponlicense [playerid/PartOfName]");
					return 1;
				}
				giveplayerid = ReturnUser(tmp);
				if(IsPlayerConnected(giveplayerid))
				{
					if(giveplayerid != INVALID_PLAYER_ID)
					{
						GetPlayerName(playerid, sendername, sizeof(sendername));
						GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
						format(string, sizeof(string), "* You've given a Weapon License to %s.",giveplayer);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "* Admin %s has given you a Weapon License.",sendername);
						SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
						PlayerInfo[giveplayerid][pGunLic] = 1;
						return 1;
					}
				}
				else
				{
					SendClientMessage(playerid, COLOR_GREY, "   That player is Offline!");
					return 1;
				}
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "   You are not authorised to use this command!");
			return 1;
		}
	}
	return 1;
	}

Acum cautam

/ahelp

si la

Admin Level 3 *

adaugam

/agl

si va arata cam asa

Admin Level 3 * /agl (si celelalte comenzi pe care le are admin-ul)

PS. Daca nu am fost destul de explicit sau aveti erori spuneti aici.

Share this post


Link to post
Share on other sites

Ti-am unit toate topicurile in care ai postat cate o comanda, intr-unul singur.

 

Aprobat in mare parte, dar din punctul meu de vedere sunt niste simple comenzi si nu constituie chiar un tutorial, mai ales ca sunt in general pentru modul GF / RP.

 

Pe viitor incearca sa renunti la a mai posta comenzi, si rezuma-te la un tutorial in adevaratul sens al cuvantului.

Exemplu: modalitati prin care ai putea face un lucru anume prin intermediul unei secvente de cod, vezi sectiunea cu tutorialele samp.

Share this post


Link to post
Share on other sites

Folositor tutorial desi cred ca foarte multi au aceste comenzi.

Share this post


Link to post
Share on other sites

Salut , am si eu o problema la comanda /newbie cand scriu /n si textul imi scrie de doua sau de cinci ori :omg: , spuneti-mi si mie cum sa il fac :3-41: , sau macar bagati altul bun

Share this post


Link to post
Share on other sites

Comanda este buna am incercat-o si eu dupa spusele tele.Atentie sa nu o mai ai vrodata in gf(desi sunt slabe sanse) ,sau daca nu folosesti functia helpers,sterge din comanda toate functile 'pHelper'.

Share this post


Link to post
Share on other sites

Nu o mai am deloc , am cerut ajutor lui Haligut care a pus aceasta comanda si a zis ca si lui ii apare la fel ca mie , de aceea v-am cerut ajutorul , am helperi pe server , si se vede ba de 2 ori ba de 5 ori .. nu stiu ce are

Share this post


Link to post
Share on other sites

Acum m-am lamurit putin.Incearca sa creezi un centru al functiei.

Defineste

new gNewbie[MAX_PLAYERS];

La OnPlayerConnect definesti si aici 'gNewbie[playerid] = 0;'.

si adaugi la comanda centrul.

		   if(gNewb[playerid] == 0)
		{
			if (PlayerInfo[playerid][pAdmin] > 0)
			format(string, sizeof(string), "Admin %s [%d]: %s ", sendername, playerid ,result);
			else if (PlayerInfo[playerid][pAdmin] == 0)
			format(string, sizeof(string), "Newbie %s [%d]: %s", sendername, playerid , result);
			else if (PlayerInfo[playerid][pHelper] == 1)
			format(string, sizeof(string), "Helper %s [%d]: %s ", sendername, playerid , result);

Completeaza si

	for (new n=0; n<MAX_PLAYERS; n++)
		{
			if (IsPlayerConnected(n) && (PlayerInfo[n][pLevel] < 3 || PlayerInfo[n][pHelper] > 0 || gNewb[n] == 0))
			{

 

Daca nu iti merge nici asa ,incearca sa faci pe acesta : http://forum.egaming.ro/arhive-tutoriale-p...ewb-t52329.html

este mult mai complex si ajuta mai mult.

Share this post


Link to post
Share on other sites

Da am reusit , multumesc mult , frumos ar fi sa ii editati si lui tutorialul ca na , nu stiu sa faca incepatori dastea ca mine :))

Share this post


Link to post
Share on other sites
Descriere: Este o simpla comanda, ca si /f, cu care pot discuta Leaderii intre ei.

La

public OnPlayerCommandText(playerid, cmdtext[])

, sub orice comanda, adaugam

///----------------------------------[LeaderChat]-----------------------------------------------
if(strcmp(cmd, "/leaderchat", true) == 0 || strcmp(cmd, "/lc", true) == 0)
{
	if(IsPlayerConnected(playerid))
	{
		GetPlayerName(playerid, sendername, sizeof(sendername));
		new length = strlen(cmdtext);
		while ((idx < length) && (cmdtext[idx] <= ' '))
		{
			idx++;
		}
		new offset = idx;
		new result[64];
		while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
		{
			result[idx - offset] = cmdtext[idx];
			idx++;
		}
				new leaders = PlayerInfo[playerid][pLeader];
		result[idx - offset] = EOS;
		result[0] = toupper(result[0]);
		if(!strlen(result))
		{
			SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/l)aders(c)hat [Chat of leaders]");
			return 1;
					}
		else if(leaders==1)
		{
			format(string, sizeof(string), "[LEADER]Police Departament %s: %s.", sendername, result);
		}
		else if(leaders==2)
		{
			format(string, sizeof(string), "[LEADER]FBI %s: %s.", sendername, result);
		}
		else if(leaders==3)
		{
			format(string, sizeof(string), "[LEADER]National Guard %s: %s.", sendername, result);
		}
		else if(leaders==4)
		{
			format(string, sizeof(string), "[LEADER]Medic %s: %s.", sendername, result);
		}
		else if(leaders==5)
		{
			format(string, sizeof(string), "[LEADER]LCN %s: %s.", sendername, result);
		}
		else if(leaders==6)
		{
			format(string, sizeof(string), "[LEADER]Yakuza %s: %s.", sendername, result);
		}
		else if(leaders==7)
		{
			format(string, sizeof(string), "[LEADER]Mayor %s: %s.", sendername, result);
		}
		else if(leaders==8)
		{
			format(string, sizeof(string), "[LEADER]Hitman %s: %s.", sendername, result);
		}
		else if(leaders==9)
		{
			format(string, sizeof(string), "[LEADER]News Reporter %s: %s.", sendername, result);
		}
		else if(leaders==10)
		{
			format(string, sizeof(string), "[LEADER]Taxi Company %s: %s.", sendername, result);
		}
		else if(leaders==11)
		{
			format(string, sizeof(string), "[LEADER]School Instructor %s: %s.", sendername, result);
		}
		else if(leaders==12)
		{
			format(string, sizeof(string), "[LEADER]Bloods %s: %s.", sendername, result);
		}
		else if(leaders==13)
		{
			format(string, sizeof(string), "[LEADER]Crips %s: %s.", sendername, result);
		}
		else if(leaders==14)
		{
			format(string, sizeof(string), "[LEADER]Nortenos %s: %s.", sendername, result);
		}
		else if(leaders==15)
		{
			format(string, sizeof(string), "[LEADER]Surenos %s: %s.", sendername, result);
		}
		if (PlayerInfo[playerid][pLeader] >= 1)
		{
			SendLeaderMessage(COLOR_1GREEN, string);
		}
		printf("Leader %s: %s", sendername, result);
	}
	return 1;
}

, acum depinde si cum aveti voi structurate factiunile, daca le aveti altfel, pur si simplu schimbati id-ul si numele factiunii.

Sper sa va fie de folos.

PS. Daca nu am fost destul de explicit sau daca apar erori, spuneti-mi aici.

 

 

Nu prea ma pricep la scripting, insa m-am uitat peste cod ca simplu cunoscator de limbaj de programare, si voiam sa te intreb, n-ar fi mai util sa folosesti un "for" la comanda de mai sus, si in functie de valoarea lui "leaders" sa se modifice?

 

Cam asa ceva ar iesi in c++ dupa mine.

Un fel de

v[1]=[Leader]Police Departament
v[2]=[Leader]FBI
v[3]=[Leader]National Guard
v[4]=[Leader]Medic
v[5]=[Leader]La Cosa Nostra
v[6]=[Leader]Yakuza
v[7]=[Leader]Mayor
v[8]=[Leader]Hitman
v[9]=[Leader]News Reporter
v[10]=[Leader]Taxi Company
v[11]=[Leader]School Instructor
v[12]=[Leader]Bloods
v[13]=[Leader]Crips
v[14]=[Leader]Nortenos
v[15]=[Leader]Surenos

for (i=1,i<=leaders,i++)
{
if(leaders==i)
 {
  format(string, sizeof(string), v[i]" %s: %s.", sendername, result);
 }
else i++;
}

 

Mie mi se pare ca executa mai putine comenzi, desi retine mai multe date.

Asta, daca se poate lucra cu vectori care sa retina caractere :O

PS: I'm newbie :ceuameni:

Share this post


Link to post
Share on other sites

S-ar putea sa merga, chiar n-am incercat, eu l-am facut ca sa intelega acesti newbie, ca daca bag ce ai facut tu acolo, ii bag in ceata cu totul :O.

Share this post


Link to post
Share on other sites

Pai incearca ceva in genul ideii mele, ca sa ma simt si eu bine! :O

Share this post


Link to post
Share on other sites

Voi incerca si revin sa-ti spun daca a functionat :O.

Share this post


Link to post
Share on other sites

Bunicel tutorial ... O intrebare : Se poate sa mai adaug si eu niste COmenzii GF in acest TOPIC ? Nu pot creea un TOPIC si de accea va intreb . Astept raspuns Multumesc ..

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

  • Recently Browsing   0 members

    No registered users viewing this page.