SA-MP Forums Archive
What is wrong with this - 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: What is wrong with this (/showthread.php?tid=297985)



What is wrong with this - vassilis - 18.11.2011

hey guys what is wrong with this..
:
pawn Код:
if(!strcmp(pname, "Blacklisted_Bboy",sizeof(pname)))
  {
  format(string,sizeof(string),"[OWNER]%s:%s",pname,text);
  SendClientMessageToAll(-1,string);
  }
because it shows me a warning..
its under OnPlayerText callback

warning:tag mismatch on this line:
pawn Код:
if(!strcmp(pname,"Blacklisted_Bboy",sizeof(pname)))



Re: What is wrong with this - LeNy - 18.11.2011

Look this:
https://sampwiki.blast.hk/wiki/Strcmp
pawn Код:
if(!strcmp(pname, "Blacklisted_Bboy", true, strlen(pname)))



Re: What is wrong with this - RyDeR` - 18.11.2011

You forgot the case:
pawn Код:
if(!strcmp(pname, "Blacklisted_Bboy", true, sizeof(pname)))
{
    format(string, sizeof(string), "[OWNER]%s:%s", pname, text);
    SendClientMessageToAll(-1, string);
}
I set to true, change if you want it different.

EDIT: LeNy was faster.


Re: What is wrong with this - Daddy Yankee - 18.11.2011

// Too late


Re: What is wrong with this - vassilis - 18.11.2011

Quote:
Originally Posted by LeNy
Посмотреть сообщение
Look this:
https://sampwiki.blast.hk/wiki/Strcmp
pawn Код:
if(!strcmp(pname, "Blacklisted_Bboy", true, strlen(pname)))
this still shows the same warning with ryder's suggestion is compiling very well but it shows the text 2 times.. :P


Re: What is wrong with this - LeNy - 18.11.2011

Show your code


Re: What is wrong with this - vassilis - 18.11.2011

pawn Код:
new pname[MAX_PLAYER_NAME];
new string[256];
GetPlayerName(playerid,pname,sizeof(pname));
  if(!strcmp(pname, "Blacklisted_Bboy", true,sizeof(pname)))
  {
  format(string,sizeof(string),"[OWNER]%s:%s",pname,text);
  SendClientMessageToAll(-1,string);
  }



Re: What is wrong with this - RyDeR` - 18.11.2011

Add "return 0;" under SendClientMessageToAll.


Re: What is wrong with this - vassilis - 18.11.2011

thx [solved]