SA-MP Forums Archive
undefined - 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: undefined (/showthread.php?tid=650745)



undefined - ivndosos - 05.03.2018

why is str undefined ?

Код:
	if(pInfo[playerid][Admin] < 1)
	{
		if(text[0] == '@')
		{
          new str[128];
		  format(str, sizeof(str), "{F781F3}(ADMIN CHAT) %s(%d): %s", PlayerName[playerid],playerid, str);
		  SendMessageToAdmins(str);
		}
		else if(pInfo[playerid][Admin] == 0)
		{
		   SendClientMessageToAll(-1, str);
		}
	}
    return 0;
}
PHP код:
SendClientMessageToAll(-1str); 



Re: undefined - AroseKhanNiazi - 05.03.2018

PHP код:
if(pInfo[playerid][Admin] < 1)
    {
new 
str[128];
        if(
text[0] == '@')
        {
          
          
format(strsizeof(str), "{F781F3}(ADMIN CHAT) %s(%d): %s"PlayerName[playerid],playeridstr);
          
SendMessageToAdmins(str);
        }
        else if(
pInfo[playerid][Admin] == 0)
        {
           
SendClientMessageToAll(-1str);
        }
    }
    return 
0;

This will fix the error, but you are doing it wrong. It won't work good try it for yourself.


Re: undefined - ivndosos - 05.03.2018

yes it did remove the include but the code doesn't seem really much different from what i've searched on how to make teamchats(admin chat in my side),

it just shows on global chat @ text


Re: undefined - ivndosos - 06.03.2018

bump


Re: undefined - Sew_Sumi - 06.03.2018

24 hour bumps only, and ensure you aren't running other FS that control the chat, or that you're returning the right returns on callbacks you use.


Re: undefined - NaS - 06.03.2018

You format the string only inside the if.

You need to format the string in the else {} as well, otherwise str will be empty at that point.


Re: undefined - AroseKhanNiazi - 06.03.2018

PHP код:
    if(text[0] == '@' && pInfo[playerid][Admin] > 0)
    {
        new 
str[128];
        
format(strsizeof(str), "{F781F3}(ADMIN CHAT) %s(%d): %s"PlayerName[playerid],playeridstr);
        
SendMessageToAdmins(str);
        return 
0;
    }
    
SendPlayerMessageToAll(playerid,text);
    return 
0;

Try this, I think this might be something you are trying to script.


Re: undefined - v1k1nG - 06.03.2018

Quote:
Originally Posted by NaS
Посмотреть сообщение
You format the string only inside the if.

You need to format the string in the else {} as well, otherwise str will be empty at that point.
^^^^