SA-MP Forums Archive
error 035: 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: error 035: argument type mismatch (argument 2) (/showthread.php?tid=591414)



error 035: argument type mismatch (argument 2) - AmirHossaiN - 11.10.2015

hello.

i have a problem on : {

PHP код:
(7521) : error 035argument type mismatch (argument 2
codes:
PHP код:
public OnPlayerConnect(playerid)
{    
    
    new 
strrr[512]; // line 7513
    
new Name[512]; // line 7514
    
GetPlayerName(playeridNamesizeof(Name)); // line 7515
    
for(new 0;c>30;c++) { // line 7517
    
new strr[55]; // line 7518
    
format(strrsizeof(strr), "[%s]"DynamicClans[c][cTag]); // line 7519
    
if(HasClanTag(playeridstrr))  // line 7520
    
// line 7521
    
string_replace(Name strr" "); // line 7522
    
SetPlayerName(playeridName); // line 7523
    
// line 7524
    
// line 7525 
line 7521:

PHP код:




Re: error 035: argument type mismatch (argument 2) - Unte99 - 11.10.2015

Show us the HasClanTag and string_replace functions.


Re: error 035: argument type mismatch (argument 2) - AmirHossaiN - 12.10.2015

Problem is string_replace:

stock string_replace(string[], find, replace)
{
for(new i=0; string[i]; i++)
{
if(string[i] == find)
{
string[i] = replace;
}
}
}


Re: error 035: argument type mismatch (argument 2) - Unte99 - 12.10.2015

Quote:
Originally Posted by AmirHossaiN
Посмотреть сообщение
Problem is string_replace:

stock string_replace(string[], find, replace)
{
for(new i=0; string[i]; i++)
{
if(string[i] == find)
{
string[i] = replace;
}
}
}
When you are creating parameters for a function, [] indicates that the parameter is going to be a string, Float: ofcourse will be a float and just a variable name will be an integer. In the code you provided, you are using all three parameters as strings.
Код:
string_replace(Name , strr, " ");
So I think it's pretty clear what you should do.