SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 22/12/2009, 09:41 PM   #1
Oi!
Big Clucker
 
Join Date: May 2009
Posts: 104
Reputation: 5
Default [Help] /joingang

Code:
	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;
	}
Code:
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?
Oi! is offline  
Old 23/12/2009, 12:28 AM   #2
Babul
High-roller
 
Babul's Avatar
 
Join Date: Sep 2009
Location: in a cement block
Posts: 1,781
Reputation: 266
Default Re: [Help] /joingang

first, try replacing each
Code:
if(id >= 9999 || id <= 1000)
with
Code:
if(id>999 && id<10000)
coz u swapped the < and > char
__________________
FireWorks

new sscanf2 custom specifiers available for Download, read the Release Topic
Babul is offline  
Old 23/12/2009, 04:41 AM   #3
Deat_Itself
Gangsta
 
Join Date: May 2009
Location: UAE (Abudhabi,Shahama)
Posts: 595
Reputation: 4
Default Re: [Help] /joingang

Use public OnPlayerText instead of gangchat
Deat_Itself is offline  
Old 23/12/2009, 03:51 PM   #4
Oi!
Big Clucker
 
Join Date: May 2009
Posts: 104
Reputation: 5
Default Re: [Help] /joingang

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?
Oi! is offline  
Old 23/12/2009, 04:46 PM   #5
Unpally09
Little Clucker
 
Join Date: Sep 2009
Posts: 7
Reputation: 0
Default Help /joingang

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
Unpally09 is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 12:01 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.