07.01.2014, 14:10
I'm trying to create a /setname command, but each time i get errors..
\test2.pwn(2256) : error 035: argument type mismatch (argument 3)
Here's the code:
\test2.pwn(2256) : error 035: argument type mismatch (argument 3)
Here's the code:
pawn Код:
CMD:setname(playerid, params[]) {
if(PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid, COLOR_RED, "[ADMIN] - You're not a high enough level to use this command!");
new string[84], newname[20], id;
new originalname[MAX_PLAYER_NAME];
GetPlayerName(id, originalname, sizeof(originalname));
new plrIP[16];
if(sscanf(params, "uc[20]", id, newname)) return SendClientMessage(playerid, COLOR_RED, "[USAGE] - /setname [ID] [NewName]");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_RED, "[NOTE] - Player not found!");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Cash",GetPlayerMoney(id));
INI_WriteInt(File,"Admin",PlayerInfo[id][pAdmin]);
INI_WriteInt(File,"Kills",PlayerInfo[id][pKills]);
INI_WriteInt(File,"Deaths",PlayerInfo[id][pDeaths]);
INI_WriteInt(File,"Score",GetPlayerScore(id));
INI_WriteInt(File,"Password",PlayerInfo[id][pPass]);
INI_WriteInt(File,"Muted",PlayerInfo[id][pMuted]);
INI_WriteInt(File,"VIP",PlayerInfo[id][pVIP]);
//INI_WriteInt(File,"Reward",PlayerInfo[playerid][pReward]);
INI_WriteInt(File,"IP",GetPlayerIp(id, plrIP, sizeof(plrIP)));
INI_WriteInt(File,"TimesWarned",PlayerInfo[id][pTimesWarned]);
INI_WriteInt(File,"TimeKicked",PlayerInfo[id][pTimesKicked]);
INI_WriteInt(File,"LoggedIn",PlayerInfo[id][pLoggedIn]);
INI_WriteInt(File,"Banned",PlayerInfo[id][pBanned]);
INI_WriteInt(File,"OriginalName",originalname); //error line
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
new receiver[MAX_PLAYER_NAME];
GetPlayerName(id, receiver, sizeof(receiver));
format(string, sizeof(string), "[ADMIN] - %s[%d] has used SETNAME on %s[%d]", pName, playerid, receiver, id);
SendMessageToAdmins(string);
format(string, sizeof(string), "* Your name has been changed to %s by %s[%d]", newname, pName, playerid);
SendClientMessage(id, COLOR_YELLOW, string);
format(string, sizeof(string), "%s", newname);
SetPlayerName(id, string);
return 1;
}