Error 035
#1

When i compile with this line in my gamemode, this error comes up
Код:
C:\Users\Mujib\My Files\SA-MP Scripts, Tools, and Webpages\Pombear RPG (Ubuntu PC)\_Server\gamemodes\prpg.pwn(11244) : error 035: argument type mismatch (argument 2)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Line 11244 is : SetPlayerName(giveplayerid, newname);

Its inside an command, the whole command is :
Код:
	if(strcmp(cmd, "/setname", true) == 0)
	{
	  tmp = strtok(cmdtext, idx);
		if(!strlen(tmp))
		{
			SendClientMessage(playerid, COLOR_GREY, "USAGE: /setmoney [playerid] [newname]");
			return 1;
		}
		giveplayerid = strval(tmp);
		tmp = strtok(cmdtext, idx);
		new newname = strval(tmp);
		if ((IsPlayerAdmin(playerid)) || PlayerInfo[playerid][pAdmin] >= 104)
		{
			format(string, sizeof(string), "-OperServ- %s's name has been changed by force to $%d,- by admin %s",PlayerName[giveplayerid], newname, PlayerName[playerid]);
			SendClientMessageToAll(COLOR_LIGHTBLUE, string);
 			SetPlayerName(giveplayerid, newname);
			return 1;
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "You are not allowed to use this command.");
		}
		return 1;
	}
Please fix this, or at least tell how to.

Thanks in advance.
Greets,
Mujib
Reply
#2

newname is set to be an integer. Completely remove newname and use tmp in SetPlayerName
Reply
#3


You should make two tmp. one for the ID and one for the new name. Not called same
Reply
#4

Mhh... i say it again: Better use SSCANF.
Benefits in compairation to strtok:
1. You save harddrive-space
2. You can script it easier (really, just the beginning might be a bit weird for you)
3. and you can do it faster than strtok.

Just little tips, you can still use strtok, if you want to, but sscanf, is much more handy with those stuff....

Cheers.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)