SA-MP Forums Archive
Strcmp problem - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Strcmp problem (/showthread.php?tid=204974)



Strcmp problem - LeNy - 30.12.2010

Hi all I have a strange problem with the function strcmp. This is the error:
Quote:

error 035: argument type mismatch (argument 1)

And here is a function GetGroupOwner:
Quote:

stock GetGroupOwner(gid)
{
new query[128];
format(query, sizeof(query), "SELECT `Owner` FROM `FRL_Grupy` WHERE `UID` = '%d'", gid);
mysql_query(query);
mysql_store_result();
if(mysql_num_rows())return mysql_fetch_row_data();
mysql_free_result();
return false;
}

and this whole if strcmp
Quote:

if(!strcmp(GetGroupOwner(gid), PlayerName(playerid)))

Please help


Re: Strcmp problem - _rAped - 30.12.2010

pawn Код:
if(strcmp(GetGroupOwner(gid), PlayerName(playerid), true) == 0)



Re: Strcmp problem - [WF]Demon - 30.12.2010

Damn to slow, Yea what he said :\


Re: Strcmp problem - LeNy - 30.12.2010

Quote:
Originally Posted by Crodox RP
Посмотреть сообщение
Damn to slow, Yea what he said :\
I tried and unfortunately does not work


Re: Strcmp problem - MrDeath537 - 31.12.2010

"GetGroupOwner(gid)" don't returns a string, that's the problem!


Re: Strcmp problem - LeNy - 31.12.2010

Quote:
Originally Posted by MrDeath
Посмотреть сообщение
"GetGroupOwner(gid)" don't returns a string, that's the problem!
And how do I do to GetGroupOwner return a string?


Re: Strcmp problem - _rAped - 31.12.2010

Quote:
Originally Posted by LeNy
Посмотреть сообщение
And how do I do to GetGroupOwner return a string?
What is the callback retrieving an integer, float or text?


Re: Strcmp problem - LeNy - 31.12.2010

Quote:
Originally Posted by _rAped
Посмотреть сообщение
What is the callback retrieving an integer, float or text?
This function is to collect the text


Re: Strcmp problem - veyron - 31.12.2010

not sure, but should work
pawn Код:
stock GetGroupOwner(gid)
{
    new query[128];
    new pname[MAX_PLAYER_NAME];
    format(query, sizeof(query), "SELECT `Owner` FROM `FRL_Grupy` WHERE `UID` = '%d'", gid);
    mysql_query(query);
    mysql_store_result();
    if(mysql_num_rows()) mysql_fetch_string(pname);
    else pname="Unknown";
    mysql_free_result();
    return pname;
}
e: free result was in wrong place


Re: Strcmp problem - LeNy - 31.12.2010

Quote:
Originally Posted by veyron
Посмотреть сообщение
not sure, but should work
pawn Код:
stock GetGroupOwner(gid)
{
    new query[128];
    new pname[MAX_PLAYER_NAME];
    format(query, sizeof(query), "SELECT `Owner` FROM `FRL_Grupy` WHERE `UID` = '%d'", gid);
    mysql_query(query);
    mysql_store_result();
    if(mysql_num_rows())mysql_fetch_string(pname);
    else pname="Unknown";
        mysql_free_result();
    return pname;
}
Yes this is it! Works perfectly

Thanks