29.11.2009, 17:33
How to make
ifisplayername patch or john or jake
kick(playerid);
else
ban(playerid);
How can i do that?
ifisplayername patch or john or jake
kick(playerid);
else
ban(playerid);
How can i do that?
new Name[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name, sizeof(Name));
if(strcmp(Name, "John", true) == 0)
{
SendClientMessage(playerid, COLOR, "Welcome John!");
}
else
{
SendClientMessage(playerid, COLOR, "Good-bye");
Kick(playerid);
}
Originally Posted by patchkinson
i dont need to do return 1;
? |
Originally Posted by patchkinson
yea
that was siliness of me ty |
Originally Posted by mavtias
Quote:
You are smart, because If you do not return 1; the code will repeat itself, in most cases. So add return 1; |
@ OnPlayerCommandText(......)
{
return 1; //no message, the command is processed
return 0; //SUC message, the command wasn't valid or was unable to be processed
}
@ OnPlayerText(......)
{
return 1; //message, the chat is processed
return 0; //no message, this script won't process the chat
}
Originally Posted by lolumadd [cod5server.tk
]
pawn Код:
|
//At the top of your script
new InvalidNames[][] = {
"Patch",
"John",
"Jake" //add as many names as you want, just don't put a comma(,) on the last one
};
public OnPlayerConnect(playerid)
{
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
for(new i = 0; i < sizeof(InvalidNames); i++)
{
if(!strcmp(pName, InvalidNames[i], true))
{
Kick(playerid);
}
}
return 1;
}