need help
#1

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!
Reply
#2

https://sampwiki.blast.hk/wiki/Strcmp
Reply
#3

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;
        } 
Reply
#4

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;
}
Reply
#5

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.
Reply
#6

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.
Reply
#7

Код:
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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)