14.03.2015, 20:57
First of all, using his example people can scam the system by just putting "name_". A better example would be checking if the surname has a greater length than 1 assuming they have an _.
Using a stock such as:
pawn Код:
if(strfind(pName, "_", true) == -1)
{
// code
}
else
{
if(strlen(GetPlayerSurname(playerid) == 0)
{
SendClientMessage(playerid, -1, "Invalid last name.");
Kick(playerid);
return 0;
}
}
pawn Код:
stock GetPlayerSurname(playerid)
{
new pName[24];
GetPlayerName(playerid, pName, sizeof(pName));
for(new i = 0; i < 24; i++)
{
if(pName[i] == '_')
{
strdel(pName, 0, i);
}
}
return pName;
}