help for /name command
#1

hey guys, i need the script for the command "/name" like if you type it (eg. /name blah) it will change your name to "blah" plz give me a script, thnx
Reply
#2

that talking about themselves or the name of the chosen?
Reply
#3

Quote:
Originally Posted by BLACK-RIDER-1692
that talking about themselves or the name of the chosen?
ye themselves ..

like if i type "/name haha" it will change MY name to 'haha'
Reply
#4

Код:
if(strcmp(cmd, "/name", true)==0){
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))return SendClientMessage(playerid, COLOR, "Usage: /name (New Name)");
SetPlayerName(playerid, tmp);
return 1;
}
Reply
#5

Quote:
Originally Posted by BLACK-RIDER-1692
Код:
if(strcmp(cmd, "/name", true)==0){
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))return SendClientMessage(playerid, COLOR, "Usage: /name (New Name)");
SetPlayerName(playerid, tmp);
return 1;
}
thnx, but what must i edit for it to work, i get errors that 'tmp' does not exsist

C:\SAMPSE~1\FILTER~1\server.pwn(119) : error 017: undefined symbol "tmp"
C:\SAMPSE~1\FILTER~1\server.pwn(120) : error 017: undefined symbol "tmp"
C:\SAMPSE~1\FILTER~1\server.pwn(121) : error 017: undefined symbol "tmp"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


3 Errors.
Reply
#6

use agin
Reply
#7

Quote:
Originally Posted by BLACK-RIDER-1692
use agin
? it doesnt work..
Reply
#8

pawn Код:
new tmp[256], idx;
Reply
#9

try this

Код:
if(strcmp(cmd, "/nickname", true) ==0)
	{
	  if(IsPlayerConnected(playerid))
	  {
			GetPlayerName(playerid, sendername, sizeof(sendername));
			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++;
			}
			result[idx - offset] = EOS;
			if(!strlen(result))
			{
				SendClientMessage(playerid, color_dgreen, "Server_CommandCheck: /nickname [name]");
				SendClientMessage(playerid, color_dgreen, "Server_CommandCheck: This name will be what others see you as.");
				return 1;
			}
			SetPlayerName(playerid, result);
			OnPlayerUpdate(playerid);

    	format(str, sizeof(str), "Your nickname has been set to '%s'", result);
    	SendClientMessage(playerid, color_white, str);
			return 1;
	  }
	  return 1;
	}
Reply
#10

Don't forget to define color_dgreen and color_white.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)