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



need help - PoniStar - 26.09.2018

hi , i want to if a player typed TEsT for exp its get this mssg:
[server] hi (exp)

i mean if he typed exacly what i want , so if he typed teSt or TesT show noting , it should detect capital words ! what exacly i say , TEsT ! how should i do that!? srry for my realy bad english!


Re: need help - v1k1nG - 26.09.2018

https://sampwiki.blast.hk/wiki/Strcmp


Re: need help - Zeus666 - 26.09.2018

PHP код:
public OnPlayerText(playeridtext[])
{
        if(
text == "TEsT")
        {
        
format(messagesizeof(message), "%s says: TEsT"PlayerName(playerid);
        
SendMessageToAllAdmins(-1,message);
                
SendClientMessage(playerid, -1""chat""COL_RED"[Server]: Hi. (exp));
        return 0;
        } 



Re: need help - d3Pedro - 26.09.2018

Quote:
Originally Posted by Zeus666
Посмотреть сообщение
PHP код:
public OnPlayerText(playeridtext[])
{
        if(
text == "TEsT")
        {
        
format(messagesizeof(message), "%s says: TEsT"PlayerName(playerid);
        
SendMessageToAllAdmins(-1,message);
                
SendClientMessage(playerid, -1""chat""COL_RED"[Server]: Hi. (exp));
        return 0;
        } 
Stop copy pasting code to help people.
OT:
Код:
public OnPlayerText(playerid, text[])
{
    if(!strcmp(text, "TesT", true))
    {
	 SendClientMessage(playerid, -1, "[Server]: Hi. (exp)");
    }
    return 0;
}



Re: need help - Calisthenics - 26.09.2018

Quote:
Originally Posted by ConnorW
Посмотреть сообщение
Stop copy pasting code to help people.
OT:
Код:
public OnPlayerText(playerid, text[])
{
    if(!strcmp(text, "TesT", true))
    {
	 SendClientMessage(playerid, -1, "[Server]: Hi. (exp)");
    }
    return 0;
}
ignorecase (3rd parameter) must be set to false.


Re: need help - solstice_ - 26.09.2018

Quote:
Originally Posted by Zeus666
Посмотреть сообщение
PHP код:
public OnPlayerText(playeridtext[])
{
        if(
text == "TEsT")
        {
        
format(messagesizeof(message), "%s says: TEsT"PlayerName(playerid);
        
SendMessageToAllAdmins(-1,message);
                
SendClientMessage(playerid, -1""chat""COL_RED"[Server]: Hi. (exp));
        return 0;
        } 
That won't work, the identation is killed, copy-pasted.


Re: need help - TheToretto - 27.09.2018

Код:
public OnPlayerText(playerid, text[])
{
    if(!strcmp(text, "TesT", false))
    {
	 SendClientMessage(playerid, -1, "[Server]: Hi. (exp)");
    }
    return 0;
}
For case sensitiveness off, set the third argument of strcmp to false.

You should thank @ConnorW