SA-MP Forums Archive
Argument mismatch error - 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: Argument mismatch error (/showthread.php?tid=608337)



Argument mismatch error - JXF - 30.05.2016

new str[72], skin;
switch (faction)
{
case 1: {str = "0x1732E8FF"; skin = 250;}
case 2: {str = "Name2"; skin = 12;}
case 14: {str = "Name15"; skin = 55;}
}
SetPlayerSkin(para1, skin);
SetPlayerColor(para1, str);

GM.pwn(43 : error 035: argument type mismatch (argument 2)


Re: Argument mismatch error - zSuYaNw - 30.05.2016

use strval

PHP код:
new 
    
str[72], 
    
skin
;


switch (
faction)
{
    case 
1: {
        
str "0x1732E8FF"
        
skin 250;
    }
    case 
2: {
        
str "Name2"
        
skin 12;
    }
    case 
14:{
        
str "Name15"
        
skin 55;
    }
}

SetPlayerSkin(para1skin);
SetPlayerColor(para1strval(str)); 



Re: Argument mismatch error - Konstantinos - 30.05.2016

strval will return 0 since the text is not numeric. What he wants to do probably isn't setting the color but the name (atleast that "Name2" and "Name15" indicates)?


Re: Argument mismatch error - zSuYaNw - 30.05.2016

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
strval will return 0 since the text is not numeric. What he wants to do probably isn't setting the color but the name (atleast that "Name2" and "Name15" indicates)?
exactly, his need change it.


Re: Argument mismatch error - JXF - 30.05.2016

I want to change the color name, not the name. Name15 is just an example.


Re: Argument mismatch error - Konstantinos - 30.05.2016

A confusing example I would say! Nevertheless, all you have to do is set the color as integer (declare a variable named "colour" for example):
pawn Код:
colour = 0x1732E8FF;
// which is equal to:
colour = 389212415;
and then:
pawn Код:
SetPlayerColor(para1, colour);



Re: Argument mismatch error - JXF - 30.05.2016

What about the cases ? set the str to the colour ?