Strval
#1

----
Reply
#2

new reason[64], pName[MAX_PLAYER_NAME], pName2[MAX_PLAYER_NAME];

Code:
		format(reason, sizeof (reason), "%s has been Kicked.%s%s",pName2, reason[0] ? (" Reason: ") : (""), reason);
		SendClientMessage(id, COLOR_BRIGHTRED, reason);
try this it should work!
Reply
#3

pawn Code:
if(!strcmp(cmdtext, "/kick", true, 5))
{
  if(!strlen(cmdtext[6]))
  {
    SendClientMessage(playerid, COLOR_ORED, "Usage: /kick [playerid] [reason]");
    return 1;
  }
  new ID = strval(cmdtext[6]);
  new pName[24], kickername[24], stri[64], strv[256],tmp[256], reason2[64];
  if(IsPlayerConnected(ID))
  {
    GetPlayerName(ID, pName, 24);
        tmp = strtok(cmdtext, idx);
        reason2 = strval(tmp);
    GetPlayerName(playerid, kickername, 24);
    //if(Admin4[ID] == 1) return SendClientMessage(playerid, red, "You cannot kick higher level admin than you are!");
    format(strv, 64, "~ You have been kicked from the server for ^%s^", reason);
    SendClientMessage(ID,COLOR_ORANGE, strv);
    Kick(ID);
    format(stri, 64, "%s has been kicked from the server", pName);
    SendClientMessageToAll(COLOR_ORED, stri);
    printf("Admin Log: %s has kicked %s for ^%s^", kickername, pName,reason);
  }
  return 1;

    }
And
Code:
C:\Users\Jani.Kannettava.000\Desktop\Server\gamemodes\paapaaof.pwn(5992) : error 033: array must be indexed (variable "reason2")
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#4

I want it works with strval, do it doesn't display the damning ID front of it.
Reply
#5

Quote:
Originally Posted by Jakku
I want it works with strval, do it doesn't display the damning ID front of it.
playerid ?
Reply
#6

If I use that what you said, it shows "~ You have been kicked from the server for ^your_id reason^

That's why I want to use strval.
Reply
#7

Code:
if(strcmp(cmd, "/kick", true) == 0)
	{
	new string[256];
  new idx;
	new tmp[256];
	new pName2[MAX_PLAYER_NAME];
		tmp = strtok(cmdtext, idx);
  		if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /report [playerid] [reason]");
		new length = strlen(cmdtext);
		while ((idx < length) && (cmdtext[idx] <= ' '))
		{
			idx++;
		}
		new offset = idx;
		new result[64];
		while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
		{
			result[idx - offset] = cmdtext[idx];
			idx++;
		}
		new player1 = strval(tmp);
		result[idx - offset] = EOS;
		if(!strlen(result)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /report [playerid] [reason]");
		if(!IsPlayerConnected(player1)) return SendClientMessage(playerid, COLOR_WHITE, "Invalid Player ID.");
		
		GetPlayerName(player1, pName2, sizeof(pName2));
				 format(string,sizeof(string),"%s has been kicked.(Reason: %s)", pName2, result);
		   SendClientMessageToAll(COLOR_ORANGE, string);
		   Kick(player1);
		
  	return 1;
	}
that should work .If there is any bug so tell me and yes iam really sorry i even forgotten your topic.
Reply
#8

strval converts a string into a value, why do you want to do that? xD
Reply
#9

Think of strval as 0,1,2,3,4,5,6, etc


TRUST US you want a string!
Reply
#10

Quote:
Originally Posted by Damon_Black
Think of strval as 0,1,2,3,4,5,6, etc


TRUST US you want a string!
yes and i tried it in my server ,it works fine !
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)