SA-MP Forums Archive
/changename(last help rly) - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: /changename(last help rly) (/showthread.php?tid=145033)



/changename(last help rly) - geerdinho8 - 30.04.2010

FIXED


Re: /changename(last help rly) - geerdinho8 - 30.04.2010

Please help


Re: /changename(last help rly) - Jefff - 30.04.2010

Код:
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;
}



Re: /changename(last help rly) - geerdinho8 - 30.04.2010

Thank you!!


Re: /changename(last help rly) - ruckfules99 - 30.04.2010

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.


Re: /changename(last help rly) - CAR - 30.04.2010

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?


Re: /changename(last help rly) - ruckfules99 - 30.04.2010

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


Re: /changename(last help rly) - CAR - 30.04.2010

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



Re: /changename(last help rly) - ruckfules99 - 30.04.2010

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



Re: /changename(last help rly) - CAR - 30.04.2010

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