CMD:changename is not working -
KillerStrike23 - 15.05.2014
@guys, There is a problem in this cmd to pawn errors its just not working as exact as I want, all I wanted is to change user udb file name I mean his acc name without removing it or changing anything in it!
my cmd:
pawn Код:
CMD:changename(playerid,params[]) {
if(PlayerInfo[playerid][Level] <= 5 || IsPlayerAdmin(playerid)) return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
new tmp[128], tmp2[128], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
if(isnull(tmp) || isnull(tmp2)) return SendClientMessage(playerid, red, "USAGE: /changename [playerid] [new name]");
new player1 = strval(tmp), length = strlen(tmp2), string[128], file[256];
if(length < 3 || length > MAX_PLAYER_NAME) return SendClientMessage(playerid,red,"ERROR: Incorrect Name Length");
if(PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
if(!IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) return SendClientMessage(playerid,red,"ERROR: Player is not connected");
if(!udb_Exists(tmp2)){
CMDMessageToAdmins(playerid,"CHANGENAME");
format(string, sizeof(string), "You have set \"%s's\" name to \"%s\" ", pName(player1), tmp2); SendClientMessage(playerid,blue,string);
SetPlayerName(player1, tmp2);
OnPlayerConnect(player1);
SaveToFile("NAMECHANGELOG ",string);
format(file, sizeof(file), "/ladmin/users/%s.sav",pName(player1));
udb_UserSet(file,"%s.sav",tmp2);
} else return SendClientMessage(playerid,red, "ERROR: That name was already taken");
return 1;}
regards!
Re: CMD:changename is not working -
AiRaLoKa - 15.05.2014
try this...
but this script is untested yet...
pawn Код:
CMD:changename(playerid,params[]) {
if(PlayerInfo[playerid][Level] <= 5 || IsPlayerAdmin(playerid)) return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
new tmp[128], tmp2[128], Index;
if(sscanf(params,"is[128]",tmp,tmp2)) return SendClientMessage(playerid, red, "USAGE: /changename [playerid] [new name]");
new length = strlen(tmp2), string[128], file[256], file2[256];
if(length < 3 || length > MAX_PLAYER_NAME) return SendClientMessage(playerid,red,"ERROR: Incorrect Name Length");
if(PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
if(!IsPlayerConnected(tmp) || tmp != INVALID_PLAYER_ID) return SendClientMessage(playerid,red,"ERROR: Player is not connected");
format(file, sizeof(file), "/ladmin/users/%s.sav",pName(tmp));
format(file2, sizeof(file2), "/ladmin/users/%s.sav",pName(tmp2));
if(!udb_Exists(file2)){
CMDMessageToAdmins(playerid,"CHANGENAME");
format(string, sizeof(string), "You have set \"%s's\" name to \"%s\" ", pName(tmp), tmp2); SendClientMessage(playerid,blue,string);
SetPlayerName(tmp, tmp2);
OnPlayerConnect(tmp);
SaveToFile("NAMECHANGELOG ",string);
udb_UserSet(file,"%s.sav",tmp2);
} else return SendClientMessage(playerid,red, "ERROR: That name was already taken");
return 1;
}
Re: CMD:changename is not working -
biker122 - 15.05.2014
Hmm, this?
pawn Код:
CMD:changename(playerid,params[]) {
if(PlayerInfo[playerid][Level] <= 5 || IsPlayerAdmin(playerid)) return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
new tmp[128], tmp2[128], Index;
if(sscanf(params,"is[128]",tmp,tmp2)) return SendClientMessage(playerid, red, "USAGE: /changename [playerid] [new name]");
new length = strlen(tmp2), string[128], file[256], file2[256];
if(length < 3 || length > MAX_PLAYER_NAME) return SendClientMessage(playerid,red,"ERROR: Incorrect Name Length");
if(PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
if(!IsPlayerConnected(tmp) || tmp != INVALID_PLAYER_ID) return SendClientMessage(playerid,red,"ERROR: Player is not connected");
format(file, sizeof(file), "/ladmin/users/%s.sav",pName(tmp));
format(file2, sizeof(file2), "/ladmin/users/%s.sav",pName(tmp2));
if(!udb_Exists(file2)){
CMDMessageToAdmins(playerid,"CHANGENAME");
format(string, sizeof(string), "You have set \"%s's\" name to \"%s\" ", pName(tmp), tmp2); SendClientMessage(playerid,blue,string);
SetPlayerName(tmp, tmp2);
OnPlayerConnect(tmp);
SaveToFile("NAMECHANGELOG ",string);
udb_RenameUser(pName(tmp),tmp2);
} else return SendClientMessage(playerid,red, "ERROR: That name was already taken");
return 1;
}
Re: CMD:changename is not working -
KillerStrike23 - 15.05.2014
PHP код:
D:\desktop files\3x-Rc1-2 Server\Gamemodes\KSTDM.pwn(9647) : error 017: undefined symbol "player1"
D:\desktop files\3x-Rc1-2 Server\Gamemodes\KSTDM.pwn(9648) : error 035: argument type mismatch (argument 1)
D:\desktop files\3x-Rc1-2 Server\Gamemodes\KSTDM.pwn(9649) : error 035: argument type mismatch (argument 1)
D:\desktop files\3x-Rc1-2 Server\Gamemodes\KSTDM.pwn(9650) : error 035: argument type mismatch (argument 1)
D:\desktop files\3x-Rc1-2 Server\Gamemodes\KSTDM.pwn(9653) : error 035: argument type mismatch (argument 1)
D:\desktop files\3x-Rc1-2 Server\Gamemodes\KSTDM.pwn(9655) : error 035: argument type mismatch (argument 1)
D:\desktop files\3x-Rc1-2 Server\Gamemodes\KSTDM.pwn(9656) : error 035: argument type mismatch (argument 1)
D:\desktop files\3x-Rc1-2 Server\Gamemodes\KSTDM.pwn(9658) : error 017: undefined symbol "udb_RenameUser"
D:\desktop files\3x-Rc1-2 Server\Gamemodes\KSTDM.pwn(9643) : warning 203: symbol is never used: "Index"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
8 Errors.
wow !!!
Re: CMD:changename is not working -
KillerStrike23 - 16.05.2014
bump*
Re: CMD:changename is not working -
KillerStrike23 - 16.05.2014
I updated it but still not working!
pawn Код:
CMD:changename(playerid,params[]) {
if(PlayerInfo[playerid][Level] >= 5 || IsPlayerAdmin(playerid)) {
new tmp[128], tmp2[128], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
if(isnull(tmp) || isnull(tmp2)) return SendClientMessage(playerid, red, "USAGE: /changename [playerid] [new user name]");
new player1 = strval(tmp), length = strlen(tmp2), string[128];
if(length < 3 || length > MAX_PLAYER_NAME) return SendClientMessage(playerid,red,"ERROR: Incorrect Name Length");
if(PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
if(!udb_Exists(tmp2)) {
CMDMessageToAdmins(playerid,"CHANGENAME");
format(string, sizeof(string), "You have changed \"%s's\" account name to \"%s\" ", pName(player1), tmp2);
SendClientMessage(playerid,blue,string);
SetPlayerName(player1, tmp2);
udb_RenameUser(pName(player1), tmp2);
return OnPlayerConnect(player1);
} else return SendClientMessage(playerid,red,"ERROR: That name had been already taken choose another one");
} else return SendClientMessage(playerid,red,"ERROR: Player is not connected");
} else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");}
Re: CMD:changename is not working -
KillerStrike23 - 16.05.2014
that cmd scrawled my life, I got more errors.
Re : CMD:changename is not working -
Ramoboss - 16.05.2014
show us the errors dude !