PDA

View Full Version : Argument type mismatch.


SukMathcuck
22/12/2016, 03:46 PM
I made this code the same does not work correctly why?


\gamemode RP\gamemodes\Roleplay.pwn(853) : error 035: argument type mismatch (argument 3)
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


1 Error.

CutX
22/12/2016, 03:52 PM
I made this code the same does not work correctly why?


\gamemode RP\gamemodes\Roleplay.pwn(853) : error 035: argument type mismatch (argument 3)
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


1 Error.


static stock SendAdminMessage(color, const str[], nivel)
{
foreach(new i: Player)
{
if(Account[i][pAdmin] >= nivel) SendSplitClientMessage(i, color, str); //error
}
printf("%s", str);
return 1;
}

stock SendSplitClientMessage(playerid, color, text[], minlen = 110, maxlen = 120)
{
new str[256];
if(strlen(text) > maxlen)
{
new pos = maxlen;
while(text[--pos] > ' ') {}
if(pos < minlen) pos = maxlen;
format(str, sizeof(str), "%.*s ...", pos, text);
SendClientMessage(playerid, color, str);
format(str, sizeof(str), ".... %s", text[pos+1]);
SendClientMessage(playerid, color, str);
}
else format(str, sizeof(str), "%s", text), SendClientMessage(playerid, color, str);
return true;
}



static stock SendAdminMessage(color, const str[], nivel)
so str is a constant

stock SendSplitClientMessage(playerid, color, text[], minlen = 110, maxlen = 120)
but here the text[] is not, that's a argument type mismatch :)

just add "const" to text[]
stock SendSplitClientMessage(playerid, color, const text[], minlen = 110, maxlen = 120)

SukMathcuck
22/12/2016, 05:55 PM
reputed, topic closed, error fixed.

Yaa
22/12/2016, 07:41 PM
reputed, topic closed, error fixed.

Don't remove code (Rule breaker)

if someone have same problem he can fix it with this exemple