/Changename help?
#1

Hello im having some trouble with this im trying to make a filterscript that would change your name but im getting this error changename.pwn(22) : warning 203: symbol is never used: "setname"
Код:
#include <a_samp>

CMD:setname(playerid, params[])
{
        if(PlayerInfo[playerid][Level] >= 6)	{
        new string[128], tmp[256], tmp2[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
		if(isnull(tmp) || isnull(tmp2)) return SendClientMessage(playerid, red, "USAGE: /setname [playerid] [new name]");
		if (udb_Exists(tmp2)) return SendClientMessage(playerid,red,"This User Name Is Taken!");
		new player1 = strval(tmp);
		if(PlayerInfo[player1][LoggedIn] == 0) return SendClientMessage(playerid,red,"Player Must Have Account!");
		new OldName[24],str[128];
		GetPlayerName(player1,OldName,sizeof(OldName));
		format(str,sizeof(str),"ladmin/users/%s.sav",OldName);
		udb_RenameUser(OldName,tmp2);
		format(str,sizeof(str),"ladmin/users/%s.sav",params);
		SetPlayerName(player1,tmp2);
		PlayerPlaySound(player1,1057,0.0,0.0,0.0);
        format(string, sizeof(string),"Admin ''%s'' Has Changed Your Name To '%s'",PlayerName2(playerid), tmp2);
		return SendClientMessage(player1,yellow,string);
	}   else return SendClientMessage(playerid,red, "ERROR: Only Level 6 can Use This Command");
}
If anyone can help me or improve it please post you will be rewarded with rep if it works.
Reply
#2

Код:
CMD:setname(playerid, params[])
{
        if(PlayerInfo[playerid][Level] >= 6)	{
        new string[128], tmp[256], tmp2[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
		if(isnull(tmp) || isnull(tmp2)) return SendClientMessage(playerid, red, "USAGE: /setname [playerid] [new name]");
		if (udb_Exists(tmp2)) return SendClientMessage(playerid,red,"This User Name Is Taken!");
		new player1 = strval(tmp);
		if(PlayerInfo[player1][LoggedIn] == 0) return SendClientMessage(playerid,red,"Player Must Have Account!");
		new OldName[24],str[128];
		GetPlayerName(player1,OldName,sizeof(OldName));
		format(str,sizeof(str),"ladmin/users/%s.sav",OldName);
		udb_RenameUser(OldName,tmp2);
		format(str,sizeof(str),"ladmin/users/%s.sav",params);
		SetPlayerName(player1,tmp2);
		PlayerPlaySound(player1,1057,0.0,0.0,0.0);
        format(string, sizeof(string),"Admin ''%s'' Has Changed Your Name To '%s'",PlayerName2(playerid), tmp2);
		return SendClientMessage(player1,yellow,string);
	}   else return SendClientMessage(playerid,red, "ERROR: Only Level 6 can Use This Command");
return 1; }
Reply
#3

Indeed but I need it to be able to compile meaning that it has to be fully scripted as a fs
Reply
#4

Did you include zcmd? Did you use OnFilterScripInit?
Reply
#5

Would you be kind to try to make it for me I will reward you with rep
Reply
#6

1 - go to ****** and write samp zcmd
2 - download the plugin + include
3 - extract the files in your directory
4 - add #include <zcmd> after #include <a_samp>
5 - recompile
Reply
#7

Here you go.
https://gist.github.com/NinjahZ/eb44bcbb8fa54e3869f4
Reply
#8

I tried the script that you made but im still getting some errors:
changename.pwn(40) : error 017: undefined symbol "PlayerInfo"
changename.pwn(40) : warning 215: expression has no effect
changename.pwn(40) : error 001: expected token: ";", but found "]"
changename.pwn(40) : error 029: invalid expression, assumed zero
filterscripts\changename.pwn(40) : fatal error 107: too many error messages on one line
and yes I have included the plugin aswell
Reply
#9

Quote:
Originally Posted by Tomix
Посмотреть сообщение
I tried the script that you made but im still getting some errors:
changename.pwn(40) : error 017: undefined symbol "PlayerInfo"
changename.pwn(40) : warning 215: expression has no effect
changename.pwn(40) : error 001: expected token: ";", but found "]"
changename.pwn(40) : error 029: invalid expression, assumed zero
filterscripts\changename.pwn(40) : fatal error 107: too many error messages on one line
and yes I have included the plugin aswell
PlayerInfo is obviously not defined.
Reply
#10

show me your login/register or enum for pCash etc please,its most probably a Capitalization error

EDIT:Please tell me you are not trying to run this filterscript,just place the CMD code I gave you into the very bottom of your gamemode script and #include <zcmd> at the top of it :P
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)