#include a_samp
public OnPlayerCommandText(playerid,cmdtext[])
{
if (strcmp("//The command you like in which player go AFK", cmdtext, true, 10) == 0)
{
new Float:health; //make a new variable which will use in health
GetPlayerHealth(playerid,health);//health of player which is important or players cheat in health
if( health > 100 )//player health is more than 100
{
TogglePlayerControllable(playerid, 0);//Setting player controllable to 0 to disable controlles of player
SetPlayerHealth(playerid, 99999);//If you set players health less the player can die
//There you can do anything like send message to all or him
return 1;
}
if( health < 100 )//player health is less than 100
{
SendClientMessage(playerid, //The color you like comment end\\,"You haven't enough health");
return 1;
}
return 1;
}
return 1;
if (strcmp("//The command you like", cmdtext, true, 10) == 0)
{
TogglePlayerControllable(playerid, 1);//1 means Player's controll enable
//You can add anything like message to all or him
return 1;
}
return 0;
}
if(strcmp("fuck you",text,false) == 0)
{
SendClientMessage(playerid, -1, Do not use bad words);
return 0;
}
|
It's easy..
pawn Code:
|
|
Actually, that's incorrect. Nice try, but now you made yourself look like an idiot.
If you're making an "anti-swear" system, wouldn't you use strfind so you can find the curse words? Strcmp checks to make sure that the strings you're comparing are an EXACT match (with toggleable case sensitivity). Note that this was a rhetorical question. Next time, think before posting. |
if((strfind(text," fuck you") != -1) || (strfind(text," FUCK YOU") != -1))
{
SendClientMessage(playerid,-1,"[WARNING]:Don't insult other people please.");
return 1;
}
return 0;
if( health < 100 )//player health is less than 100
{
SendClientMessage(playerid, //The color you like comment end\\,"You haven't enough health");
return 1;
}
if( health > 100 )