paintjobs || clan chat
#1

how can I make custom paintjobs with command? like in my sign bellow. it`s in one server which has 20paintjobs to evry race cars (tunable in archangles) and evry car has 20difrent paintjobs
================================================== =========================
how can I make clan chat? but I need one command for 2 or more clans. GF mode has something like it, but I don`t know how to convert it to make for clan chat
Reply
#2

With gang chat I presume you're looking for a certain clantag in a players name

the chat command
Код:
if (strcmp(cmdtext, "/clanchat", true) == 0)
{
   if (!IsPlayerInClanChatClan(playerid))
      return SendClientMessage(playerid, COLOUR, "You cannot use this command");

   // do something to get a nice layout for the string here

   for (new i; i < MAX_PLAYERS; i++)
   {
      if (!IsPlayerConnected(i)) 
         continue;
      if (IsPlayerInClanChatClan(i)
         SendClientMessage(i, COLOR, string);
   }
   return 1;
}
the custom function would look a bit like this:
Код:
stock IsPlayerInClanChatClan(playerid) // goofy function name, I know
{
   new playername[32];
   GetPlayerName(playerid,playername,32);

   if (strfind(playername, "[CLANTAG1]", false) > -1 || strfind(playername, "]=CLANTAG2=[", false) > -1)
      return 1;

   return 0;
}
it won't fully work like this, but if you know a bit of coding you can easily tweak it to your needs
Reply
#3

Quote:
Originally Posted by Rav
With gang chat I presume you're looking for a certain clantag in a players name

the chat command
Код:
if (strcmp(cmdtext, "/clanchat", true) == 0)
{
   if (!IsPlayerInClanChatClan(playerid))
      return SendClientMessage(playerid, COLOUR, "You cannot use this command");

   // do something to get a nice layout for the string here

   for (new i; i < MAX_PLAYERS; i++)
   {
      if (!IsPlayerConnected(i)) 
         continue;
      if (IsPlayerInClanChatClan(i)
         SendClientMessage(i, COLOR, string);
   }
   return 1;
}
the custom function would look a bit like this:
Код:
stock IsPlayerInClanChatClan(playerid) // goofy function name, I know
{
   new playername[32];
   GetPlayerName(playerid,playername,32);

   if (strfind(playername, "[CLANTAG1]", false) > -1 || strfind(playername, "]=CLANTAG2=[", false) > -1)
      return 1;

   return 0;
}
it won't fully work like this, but if you know a bit of coding you can easily tweak it to your needs
what I must put there?
Reply
#4

ugh, lazy people


Код:
if (strcmp(cmdtext, "/clanchat", true) == 0)
{
   if (!IsPlayerInClanChatClan(playerid))
      return SendClientMessage(playerid, COLOUR, "You cannot use this command");

   // one nice string coming up
   new params[128], string[128], playername[32];
   GetPlayerName(playerid, playername, 32);
   strmid(params, cmdtext, strfind(cmdtext," ", strlen(params));

   format(string, sizeof(string), "[CLANCHAT] %s: %s", playername, params);
   // by now, you owe me already

   for (new i; i < MAX_PLAYERS; i++)
   {
      if (!IsPlayerConnected(i)) 
         continue;
      if (IsPlayerInClanChatClan(i)
         SendClientMessage(i, COLOR, string);
   }
   return 1;
}
Reply
#5

but I need so ewry clan have their own chat, but they can post with the same command
Reply
#6

oh, well you'll need to be able to recognise what a clantag is, let's just presume it's always the first bit of a players name.. like.. [CLAN]PlayerName, and can only be of this type: [TAG] (most are)

Код:
stock GetPlayerClanTag(playerid) // I like this function name much more
{
   new playername[32], clantag[5];
   GetPlayerName(playerid,playername,32);

   // why not bigger than 4? some people have their names in brackets, just a filter,also fits nicely with the clantag string atm
   if (strfind(playername, "[", false) == 0 && 5 > strfind(playername, "]", false) > 1) 
   {
      strmid(clantag, playername, 0, strfind(playername, "]", false)+1);
      return clantag;
   }

   return -1;
}
Код:
if (strcmp(cmdtext, "/clanchat", true) == 0)
{
   if (GetPlayerClanTag(playerid) == -1)
      return SendClientMessage(playerid, COLOUR, "You cannot use this command");

   // one nice string coming up
   new params[128], string[128], playername[32];
   GetPlayerName(playerid, playername, 32);
   strmid(params, cmdtext, strfind(cmdtext," ", strlen(params));

   format(string, sizeof(string), "[CLANCHAT] %s: %s", playername, params);
   // by now, you owe me already

   for (new i; i < MAX_PLAYERS; i++)
   {
      if (!IsPlayerConnected(i)) 
         continue;
      if (strcmp(GetPlayerClanTag(playerid), GetPlayerClanTag(i) == 0)
         SendClientMessage(i, COLOR, string);
   }
   return 1;
}
something like that
Reply
#7

ehh... I tries something diffrent, but I have few erorrs
Код:
	if (strcmp(cmdtext, "/cc", true) == 0)
	{
	new Nick[MAX_PLAYER_NAME];
 	if (!IsPlayerInClanChatClan(playerid))
 	return SendClientMessage(playerid, COLOR_RED, "Tu neesi nevienaa klanaa");

	if(strfind(Nick, "]pods[", true) != -1 || strfind(Nick, "]vista[, true) != -1)
 	// one nice string coming up
 	new params[128];
	new string[128];
	new playername[32];
 	GetPlayerName(playerid, playername, 32);
 	strmid(params, cmdtext, strfind(cmdtext," ", strlen(params));

   format(string, sizeof(string), "[CLANCHAT] %s: %s", playername, params);
   // by now, you owe me already
  else if(strfind(Nick, "niks vai klans", true) != -1 || strfind(Nick, "niks vai klans", true) != -1)
   strmid(params, cmdtext, strfind(cmdtext," ", strlen(params));

   format(string, sizeof(string), "[CLANCHAT] %s: %s", playername, params);

   for (new i; i < MAX_PLAYERS; i++)
   {
      if (!IsPlayerConnected(i))
         continue;
      if (IsPlayerInClanChatClan(i)
         SendClientMessage(i, COLOR, string);
   }
   return 1;
}
and here are the erorrs
Код:
D:\samp server\gamemodes\sftdm.pwn(594) : error 003: declaration of a local variable must appear in a compound block
D:\samp server\gamemodes\sftdm.pwn(594) : error 017: undefined symbol "params"
D:\samp server\gamemodes\sftdm.pwn(594) : warning 215: expression has no effect
D:\samp server\gamemodes\sftdm.pwn(594) : error 001: expected token: ";", but found "]"
D:\samp server\gamemodes\sftdm.pwn(594) : fatal error 107: too many error messages on one line
Reply
#8

you did more things wrong than you get errors for, look at my previous post, and try to learn a bit about scripting
Reply
#9

but many clans isn`t using "[" and "]" in front, some use them at back some use _ and _ in front on back and many more so I want add clans manually
Reply
#10

again, read some of my posts here, they contain exactly what you want..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)