strfind
#1

Hello guys little help i want help on this text so im try to create but i cant
pawn Код:
if(strfind("hey heal me", "hey heal me", true) != -1) //returns 4 (!= -1 because -1 would be 'not found')
    {
    if(IsPlayerAdmin(playerid))
    {
   
   
    SetPlayerHealth(playerid, 100.0);
    }
    }
if(strfind("hey armour me", "hey armour me", true) != -1) //returns 4 (!= -1 because -1 would be 'not found')
    {
    if(IsPlayerAdmin(playerid))
    {
   
   
    SetPlayerArmour(playerid, 100.0);
    }
    }
im add it Onplayertext but its work both so when im type hey heal me its give armour too T_T can someone fix this ? thx a lot >< /// COlonel
Reply
#2

pawn Код:
public OnPlayerText(playerid, text[])
{
if(strcmp(text,"hey heal me", true) != -1)
    {
    if(IsPlayerAdmin(playerid))
    {
   
   
    SetPlayerHealth(playerid, 100.0);
    }
    }
return 1;
}
Reply
#3

ahh its not work lol its do same both T_T
Reply
#4

delete
Reply
#5

pawn Код:
public OnPlayerText(playerid, text[])
{
if(IsPlayerAdmin(playerid))
{
if(strfind("heal", text, true) != -1)
SetPlayerHealth(playerid,100.0);
}
return 1;
}
Reply
#6

pawn Код:
public OnPlayerText(playerid, text[])
{
    if(IsPlayerAdmin(playerid))
    {
        if(!strcmp(text,"hey heal me", true))
        {
            SetPlayerHealth(playerid, 100.0);
            return 0; //The text will not show up in chat but the player will be healed.
        }
    }
    return 1;
}
That should work. strcmp returns 0 if the string matches by the way.
Reply
#7

Yeah Is work thx mineralo
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)