SA-MP Forums Archive
Send message to mechanics help... - 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: Send message to mechanics help... (/showthread.php?tid=74812)



Send message to mechanics help... - nickbugun - 26.04.2009

I want that whenever a player types /service mechanic a message gets sent to all mechanics and tells them "%s is looking for a mechanic!"..
Here is the code I used but I have no idea what I am doing:
Код:
	if (strcmp(cmdtext, "/service mechanic", true) == 0)
	{
	new conname[MAX_PLAYER_NAME];
  	new string[48];
  	GetPlayerName(playerid, conname, sizeof(conname));
  format(string, sizeof(string), "%s needs a Mechanic.",conname);
  SendClientMessageToAll(ORANGE, string);
	return 1;
  }



Re: Send message to mechanics help... - Andom - 26.04.2009

replace:
Код:
format(string, sizeof(string), "%s needs a Mechanic.",conname);
SendClientMessageToAll(ORANGE, string);
with:


Код:
format(string, sizeof(string), "%s needs a Mechanic.",conname);
for(new i = 0; i < MAX_PLAYERS; i++)
{
  if(gTeam[i] == TEAM_MECHANIC)
  {
     SendClientMessageToPlayer(i, ORANGE, string);
  }
}
Convert TEAM_MECHANIC to whatever you want, because i dont know how teams are maked in your gamemode.
And also change "/service mechanic" to something else without space, because the way you do you can't use space.


Re: Send message to mechanics help... - nickbugun - 26.04.2009

thanks!!!