SA-MP Forums Archive
[Help] OnPlayerText - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [Help] OnPlayerText (/showthread.php?tid=135611)



[Help] OnPlayerText - borisblat - 21.03.2010

Hi, I tried to create a command that only people from the clan union will can see,
Код:
 if(text[0] == '#')
	{
		new unionname[256], clanname[256], iname[MAX_PLAYER_NAME], iclanname[256], iunionname[256];
		if(dini_Isset(file, "Clan"))
		{
			clanname = GetPlayerClanName(playerid);
			format(cfile, sizeof(cfile), "%s/Clans/%s.txt", AdminNameMinor, clanname);
			if(dini_Isset(cfile, "Union"))
			{
				unionname = dini_Get(cfile, "Union");
				format(string, sizeof(string), "[Union - %s] %s[id:%d]: %s", unionname, name, playerid, text[1]);
				for(new i = 0; i<MAX_PLAYERS; i++)
				{
					 GetPlayerName(i, iname, sizeof(iname));
					 format(file, sizeof(file), "%s/Users/%s.txt", AdminNameMinor, iname);
					 if(dini_Isset(file, "Clan"))
           {
					   iclanname = GetPlayerClanName(i);
					   format(cfile, sizeof(cfile), "%s/Clans/%s.txt", AdminNameMinor, iclanname);
					   if(dini_Isset(cfile, "Union"))
					   {
							 iunionname = dini_Get(cfile, "Union");
               if(strcmp(iunionname,unionname, true) == 0)
								 SCM(i, UNION, string);
						 }
					 }
				}
			}
		}
		return 0;
	}
the thing is, i want that it will be when i type '%' and not when i type '#'
I tried to change it but it won't work when I do
Код:
if(text[0] == '%')
how can i fix this?

thakns


Re: [Help] OnPlayerText - Rac3r - 21.03.2010

Код:
if(strcmp("#",text[0],true) == 0)



Re: [Help] OnPlayerText - Kyosaur - 21.03.2010

Quote:
Originally Posted by Rac3r
Код:
if(strcmp("#",text[0],true) == 0)
What he said.


Aslo, i would change the character to something other than '%' as that is automatically change and could cause issues / it may even be the reason its not working (maybe it could be @ ?).


Re: [Help] OnPlayerText - borisblat - 21.03.2010

No, you didn't understand this well..
when i use this : if(text[0] == '#')
this works,
but when i do if(text[0] == '%')
this won't work

same as if i do if(strcmp("%',text[0],true) == 0)

and Kyosaur!!, i just think it will be more confortable to do '%'
'@' i used for adminchat



Re: [Help] OnPlayerText - Kyosaur - 21.03.2010

Quote:
Originally Posted by borisblat
No, you didn't understand this well..
when i use this : if(text[0] == '#')
this works,
but when i do if(text[0] == '%')
this won't work

same as if i do if(strcmp("%',text[0],true) == 0)

and Kyosaur!!, i just think it will be more confortable to do '%'
'@' i used for adminchat
I understood you just fine, both ways work, some just prefer other ways.


ok, do me a favor, change '%' to '?' ... go on your server and type in % testinnng. The character '%' is automatically switch to a question mark to prevent string manipulation (if it didnt, /pm 1 %s would crash the server). Changing the '%' to '?' should work if you type in a question mark, or a percent sign.