/changename(last help rly)
#1

FIXED
Reply
#2

Please help
Reply
#3

Код:
if(!strcmp(cmd, "/changename", true))
{
	if(!logged[playerid]) return SendClientMessage(playerid, COLOR_RED, "SERVER: You Are Not Logged In");
	tmp = strtok(cmdtext,idx);
	if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /changename [newname]");
	GetPlayerName(playerid, playername, sizeof(playername));
	if(fexist(udb_encode(playername))) {
		if(!fexist(udb_encode(tmp))) {
			SetPlayerName(playerid, tmp);
			frename(udb_encode(playername),udb_encode(tmp));
			format(string, sizeof(string), "%s has changed his/her name to %s.",playername, tmp);
			SendClientMessageToAll(COLOR_YELLOW, string);
			format(string, sizeof(string), "You have succesfully changed your name to %s.", tmp);
			SendClientMessage(playerid, COLOR_GREEN, string);
		}else SendClientMessage(playerid, COLOR_GREEN, "This name is already in use");
	}//else SendClientMessage(playerid, COLOR_GREEN, "You dont have account");
	return 1;
}
Reply
#4

Thank you!!
Reply
#5

Quote:
Originally Posted by Jefff
Код:
if(!strcmp(cmd, "/changename", true))
{
	if(!logged[playerid]) return SendClientMessage(playerid, COLOR_RED, "SERVER: You Are Not Logged In");
	tmp = strtok(cmdtext,idx);
	if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /changename [newname]");
	GetPlayerName(playerid, playername, sizeof(playername));
	if(fexist(udb_encode(playername))) {
		if(!fexist(udb_encode(tmp))) {
			SetPlayerName(playerid, tmp);
			frename(udb_encode(playername),udb_encode(tmp));
			format(string, sizeof(string), "%s has changed his/her name to %s.",playername, tmp);
			SendClientMessageToAll(COLOR_YELLOW, string);
			format(string, sizeof(string), "You have succesfully changed your name to %s.", tmp);
			SendClientMessage(playerid, COLOR_GREEN, string);
		}else SendClientMessage(playerid, COLOR_GREEN, "This name is already in use");
	}//else SendClientMessage(playerid, COLOR_GREEN, "You dont have account");
	return 1;
}
Can you please help me out? i've been looking for a /changename command for a while now, and cannot find one.

I use dudb and i tried adding this into my script, compiled without errors but when i go in game and type /changename Jeff nothing happens.
Reply
#6

Quote:
Originally Posted by ruckfules99
Can you please help me out? i've been looking for a /changename command for a while now, and cannot find one.

I use dudb and i tried adding this into my script, compiled without errors but when i go in game and type /changename Jeff nothing happens.
Are your files saved as .txt or something?
Reply
#7

Quote:
Originally Posted by CAR
Quote:
Originally Posted by ruckfules99
Can you please help me out? i've been looking for a /changename command for a while now, and cannot find one.

I use dudb and i tried adding this into my script, compiled without errors but when i go in game and type /changename Jeff nothing happens.
Are your files saved as .txt or something?
My files are saved as .dudb in the script files folder
Reply
#8

Don't know if you use logged...
pawn Код:
if(!strcmp(cmd, "/changename", true))
{
    if(!logged[playerid]) return SendClientMessage(playerid, COLOR_RED, "SERVER: You Are Not Logged In"); // delete if you don't use
    tmp = strtok(cmdtext,idx);
    if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /changename [newname]");
    GetPlayerName(playerid, playername, sizeof(playername));
       new playerfile[30], newfile[30], newname;
       newname = strval(tmp);
       format(playerfile, sizeof(playerfile), "%s.dudb, playername);
       format(newfile, sizeof(newfile), %s.dudb, newname);
    if(fexist(playerfile)) {
        if(!fexist(newfile)) {
            SetPlayerName(playerid, tmp);
            frename(playerfile,newfile);
            format(string, sizeof(string), "
%s has changed his/her name to %s.",playername, tmp);
            SendClientMessageToAll(COLOR_YELLOW, string);
            format(string, sizeof(string), "
You have succesfully changed your name to %s.", tmp);
            SendClientMessage(playerid, COLOR_GREEN, string);
        }else SendClientMessage(playerid, COLOR_GREEN, "
This name is already in use");
    }//else SendClientMessage(playerid, COLOR_GREEN, "
You dont have account");
    return 1;
}
Reply
#9

Thanks for the reply.


I tested the code, it gives me the following errors



Код:
error 017: undefined symbol "playername"
error 017: undefined symbol "playername"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line
If i add
pawn Код:
new playername[32];
It gets rid of those errors but gives me new ones.

Код:
invalid string (possibly non-terminated string)
error 029: invalid expression, assumed zero
error 017: undefined symbol "dudb"
fatal error 107: too many error messages on one line
Reply
#10

On which line?

And use on top #include <dudb>
If you don't got that, download it.

Please send the lines where the errors are
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)