Need Help here with strings
#1

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
Reply
#2

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;
}
Reply
#3

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;
		   	  }
		}
	}
Reply
#4

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;
            }
        }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)