strfind - 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: strfind (
/showthread.php?tid=436124)
strfind -
colonel-top - 10.05.2013
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
Re: strfind -
RajatPawar - 10.05.2013
pawn Код:
public OnPlayerText(playerid, text[])
{
if(strcmp(text,"hey heal me", true) != -1)
{
if(IsPlayerAdmin(playerid))
{
SetPlayerHealth(playerid, 100.0);
}
}
return 1;
}
Re: strfind -
colonel-top - 10.05.2013
ahh its not work lol its do same both T_T
Re: strfind -
Logic - 10.05.2013
delete
Re: strfind -
mineralo - 10.05.2013
pawn Код:
public OnPlayerText(playerid, text[])
{
if(IsPlayerAdmin(playerid))
{
if(strfind("heal", text, true) != -1)
SetPlayerHealth(playerid,100.0);
}
return 1;
}
Re: strfind -
[HiC]TheKiller - 10.05.2013
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.
Re: strfind -
colonel-top - 10.05.2013
Yeah Is work thx mineralo