[Help] /joingang
#1

Код:
	if (strcmp(cmd, "/makegang", true) == 0)
	{
		tmp = strtok(cmdtext, idx);
		if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /makegang [4 digit number]");
		new id;
		id = strval(tmp);
		if(id >= 9999 || id <= 1000)
		{
			SendClientMessage(playerid, COLOR_GRAD1, "The gang you are creating must be between 1000-9999");
		}
		else
		{
			gChat[playerid] = id;
			PlayerInfo[playerid][pGChat] = id;
		}
		return 1;
	}
	if (strcmp(cmd, "/joingang", true) == 0)
	{
		tmp = strtok(cmdtext, idx);
		if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /joingang [gangid 1000-9999]");
		new id;
		id = strval(tmp);
		if(id >= 9999 || id <= 1000)
		{
			SendClientMessage(playerid, COLOR_GRAD1, "The gang you are creating must be between 1000-9999");
		}
		else
		{
			gChat[playerid] = id;
			PlayerInfo[playerid][pGChat] = id;
		}
		return 1;
	}
	if (strcmp(cmd, "/quitgang", true) == 0)
	{
		gChat[playerid] = 0;
		PlayerInfo[playerid][pGChat] = 0;
		return 1;
	}
	if(strcmp(cmd, "/gang", true) == 0 || strcmp(cmd, "/g", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
  			if(gChat[playerid] != 0)
  			{
				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++;
				}
				if(!strlen(result))
				{
					SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/g)ang [gang chat]");
					return 1;
				}
				format(string, sizeof(string), "%s: %s ", sendername, result);
				GangChat(COLOR_GCHAT,string);
				printf("%s", string);
			}
			else
			{
				SendClientMessage(playerid, COLOR_GRAD2, "  you arn't in a gang!");
				return 1;
			}
		}//not connected
		return 1;
	}
Код:
public GangChat(color,const string[])
{
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i))
		{
		  if(!gChat[i])
		  {
				SendClientMessage(i, color, string);
			}
		}
	}
}
Everything works, accept when I try and talk in /g it doesn't work. Can somebody please help me figure this out?
Reply
#2

first, try replacing each
Код:
if(id >= 9999 || id <= 1000)
with
Код:
if(id>999 && id<10000)
coz u swapped the < and > char
Reply
#3

Use public OnPlayerText instead of gangchat
Reply
#4

Okay I fixed it... But one thing, I'm trying to make it so that when you type /joingang the other members in that gang will show up on your minimap, make the color of their names like green or something so that you can see your other gang members. and same with when you login, you see your gang members. How could I make that possible?
Reply
#5

you can help whats your email address so you can help me

its a points mod how do i install that into my site?

thanks
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)