SA-MP Forums Archive
If player name includes '_'.. - 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: If player name includes '_'.. (/showthread.php?tid=657834)



If player name includes '_'.. - Jing_Chan - 15.08.2018

How do I get the script to check if a player's name includes '_'?


Re: If player name includes '_'.. - GRiMMREAPER - 15.08.2018

strfind is all you need.

pawn Code:
new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, sizeof pName);

    if(strfind(pName, "_") != -1) {
        // Name has underscore.
    }



Re: If player name includes '_'.. - Jing_Chan - 15.08.2018

Quote:
Originally Posted by GRiMMREAPER
View Post
strfind is all you need.

pawn Code:
new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, sizeof pName);

    if(strfind(pName, "_") != -1) {
        // Name has underscore.
    }
Great, I'll check this out and see if it worked (I'm sure it will)

Thank you.