SA-MP Forums Archive
[HELP!!] argument type mismatch (argument 2) - 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)
+--- Thread: [HELP!!] argument type mismatch (argument 2) (/showthread.php?tid=551934)



[HELP!!] argument type mismatch (argument 2) - Ejecter - 21.12.2014

Код:
if(dialogid == 2626262626)
	{
		if(!response) return 1;
		if(strlen(inputtext))
		{
			new xObjFormat[128];
	                new Float:X, Float:Y, Float:Z;
			GetPlayerPos(playerid, X, Y, Z);
			format(xObjFormat,sizeof(xObjFormat),"%s",inputtext);
			new xXObject;
		 	xXObject = CreateObject(xObjFormat, X, Y, Z, 0.0, 0.0, 0.0);
			EditObject(playerid, xXObject);
    	}
		return 1;
	}
The Warning
C:\Users\Bar\Desktop\KakiGadol\gamemodes\RoshBeich a.pwn(13046) : error 035: argument type mismatch (argument 1)

Line 13046:
Код:
xXObject = CreateObject(xObjFormat, X, Y, Z, 0.0, 0.0, 0.0);



Re: [HELP!!] argument type mismatch (argument 2) - Nimrod - 21.12.2014

The first parameter of CreateObject isn't a string, it's a integer (the model ID of the object).


Re: [HELP!!] argument type mismatch (argument 2) - Ejecter - 21.12.2014

Quote:
Originally Posted by Nimrod
Посмотреть сообщение
The first parameter of CreateObject isn't a string, it's a integer (the model ID of the object).
Soo, how fix this?


Re: [HELP!!] argument type mismatch (argument 2) - Nimrod - 21.12.2014

Quote:
Originally Posted by Ejecter
Посмотреть сообщение
Soo, how fix this?
Код:
CreateObject(strval(inputtext), X, Y, Z, 0.0, 0.0, 0.0);
You convert the inputtext to an integer.


AW: [HELP!!] argument type mismatch (argument 2) - Flori - 21.12.2014

String to integer -> strval

https://sampwiki.blast.hk/wiki/Strval


Re: [HELP!!] argument type mismatch (argument 2) - Pottus - 21.12.2014

You also need to confirm your input is valid as well.

new model = strval(inputtext);

Then verify it is a valid model

https://sampforum.blast.hk/showthread.php?tid=323397

if(IsValidModel(model))
{

}