Symbol nickname - 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: Symbol nickname (
/showthread.php?tid=609354)
Symbol nickname -
2k16 - 11.06.2016
How to detect a player nickname contains the symbol "[, ], ), ("? and automatically kicked
Re: Symbol nickname -
]Rafaellos[ - 11.06.2016
Loop the nickname and compare characters.
Re: Symbol nickname -
Sjn - 11.06.2016
PHP код:
// Inside OnPlayerConnect callback or wherever you want to check
new
name[24];
GetPlayerName(playerid, name, sizeof(name));
for (new i, j = strlen(name); i != j; ++i)
{
switch (name[i])
{
case '[', ']', '(', ')':
{
// Symbols detected, kick the player.
}
}
}
Re: Symbol nickname -
Kaliber - 11.06.2016
Here a function for you:
PHP код:
stock isCharInString(const tmp[],const chars[])
{
for(new i,buffer[1],l=strlen(chars); i<l; i++)
{
buffer[0] = chars[i];
if(strfind(tmp,buffer,false) != -1) return true;
}
return false;
}
//You can use it like this:
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,MAX_PLAYER_NAME);
if(isCharInString(tmp,"]<()[>"))
{
//Here some of the chars are in the name
}