SA-MP Forums Archive
Need Help here with strings - 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: Need Help here with strings (/showthread.php?tid=509811)



Need Help here with strings - saikumar - 28.04.2014

Hello guys i made this dialog response for the rules
Код:
switch(dialogid)
	{
		case 1:
		{
			if(!response)
			  {
			  Kick(playerid);
			  return 1;
                          }
			else if(response)
			  {
                          SendClientMessage(playerid, 0xFF0000FF, "Thanks for accepting the rules. Enjoy the peaceful stay.");
			  return 1;
		   	  }
		}
	}
if player disagree the rules he will get a kick
and i want to add that client message to all with "player Blabla has been kicked for not accepting the rules."
how to get player name on the client message?

Thanks in Advance for help


Re: Need Help here with strings - NviDa - 28.04.2014

Here is how you format the string etc.But you want the players name to be shown when player gets kicked.
To di that you need somehow connect it with that dialog of yours.I don't know how to do that.
So here is how to format the string.


Add it under OnPlayerConnect
pawn Код:
public OnPlayerConnect(playerid)
{
* * new name[MAX_PLAYER_NAME], string[23 + MAX_PLAYER_NAME];
* * GetPlayerName(playerid, name, sizeof(name));
* * format(string, sizeof(string), "%s has joined the server", name);
* * SendClientMessageToAll(0xFFFF00FF, string);
* * return 1;
}



Re: Need Help here with strings - saikumar - 28.04.2014

anybody know exact format?


do this work

Код:
switch(dialogid)
	{
		case RULES:
		{
			if(!response)
			  {
			  SendClientMessage(playerid, 0xFF0000FF, "You Have been kicked for not accepting the rules.");
			  Kick(playerid);
			  new name[MAX_PLAYER_NAME], string[23 + MAX_PLAYER_NAME];
			  GetPlayerName(playerid, name, sizeof(name));
			  format(string, sizeof(string), "%s has kicked from the server for not accepting rules", name);
              SendClientMessageToAll(0xFF0000FF, string);
			  return 1;
              }
			else if(response)
			  {
              SendClientMessage(playerid, 0xFF0000FF, "Thanks for accepting the rules. Enjoy the peaceful stay.");
			  return 1;
		   	  }
		}
	}



Re: Need Help here with strings - IceBilizard - 28.04.2014

pawn Код:
switch(dialogid)
{
        case 1:
        {
            if(!response)
            {
              new pname[MAX_PLAYER_NAME],string[70];
              GetPlayerName(playerid, pname, sizeof(pname));
              format(string,sizeof(string),"%s has been kicked from the server",pname);
              SendClientMessageToAll(COLOR_RED,string);
              Kick(playerid);
              return 1;
            }
            else if(response)
            {
              SendClientMessage(playerid, 0xFF0000FF, "Thanks for accepting the rules. Enjoy the peaceful stay.");
              return 1;
            }
        }
}