SA-MP Forums Archive
Announce - 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)
+--- Thread: Announce (/showthread.php?tid=470452)



Announce - .::: Ecko :::. - 18.10.2013

I'm making a gang system which is pretty much finished but I'm not able to test it.
So I wanted to ask you guys if its possible or not to make a command like I did. (Actually cmd /announce should be used only and only by the leaders of the gang.The function is obvious, the text which the leader wants to be announce gets announced on 'gamemodetext .

Код:
CMD:announce(playerid, params[])
{
	new string[500];
	if(unformat(params, "s[500]", string)) return SendClientMessage(playerid, 0xFF0000AA, "Usage: /announce <text>");
	if(!(PlayerInfo[playerid][GangID] > 0)) return SendClientMessage(playerid, 0xFF0000AA, "You are not in a gang!");
	new gangid = PlayerInfo[playerid][GangID];
    SendGangAnnounce(gangid,string,playerid);
	return 1;
}
Код:
forward SendGangAnnounce(gangid,const msj[],playerid);
public SendGangAnnounce(gangid,const msj[],playerid)
{
	new string[500];
	for(new i=0;i<MAX_PLAYERS;i++)
	{
	    if(IsPlayerConnected(i))
	    {
	    	if(PlayerInfo[i][GangID] == gangid)
	    	{
	    	    switch(playerid)
	    	    {
	    	        case -1:
	    	        {
	    	            GameTextForPlayer(playerid, string, 5000, 6); //this shoudl be sendclienttext nto gamtext
	    	        }
					default:
					{
						switch(PlayerInfo[playerid][GangRank])
						{
						    case 1: format(string, sizeof(string), "1*level %s: %s",PlayerName(playerid), msj); //newbie
						    case 2: format(string, sizeof(string), "2*level %s: %s",PlayerName(playerid), msj); //little clucker
						    case 3: format(string, sizeof(string), "3*level %s: %s",PlayerName(playerid), msj); //huge clucker
						    case 4: format(string, sizeof(string), "4*level %s: %s",PlayerName(playerid), msj); //high roller
						    case 5: format(string, sizeof(string), "5*level %s: %s",PlayerName(playerid), msj); // gangsta
						}
						GameTextForPlayer(playerid, string, 5000, 6);//this might be changed to
					}
				}
			}
		}
	}
	return 1;
}
So the point is,once again, I want to make it working if it's not like this. Leader types /annoucne <text>
the text gets announced on the screen of each member of the gang.

Thank you.


Re: Announce - .::: Ecko :::. - 18.10.2013

Would it work like this?


Re: Announce - BadFella - 18.10.2013

pawn Код:
CMD:announce(playerid, params[])
{
    new string[500];
    if(unformat(params, "s[500]", string)) return SendClientMessage(playerid, 0xFF0000AA, "Usage: /announce <text>");
    if(!(PlayerInfo[playerid][GangID] > 0 && (PlayerInfo[playerid][leader] > 0)) return SendClientMessage(playerid, 0xFF0000AA, "You are not in a gang!");
    new gangid = PlayerInfo[playerid][GangID];
    SendGangAnnounce(gangid,string,playerid);
    return 1;
}