Vice City: Multiplayer

Server Development => Scripting and Server Management => Script and Content Requests => Topic started by: Kewun on Jul 27, 2016, 07:10 PM

Title: Name with _ like in roleplay
Post by: Kewun on Jul 27, 2016, 07:10 PM
I want a script

where you have to use a name with usage _ like in samp roleplay server,s

example, Sebastian_Klemens

real names

how?
Title: Re: Name with _ like in roleplay
Post by: EK.IceFlake on Jul 27, 2016, 07:33 PM
if (player.Name.find("_") == null) //Do your shets here
Title: Re: Name with _ like in roleplay
Post by: aXXo on Jul 27, 2016, 07:45 PM
Split player name with _
Make sure, the number of tokens == 2
Make sure both token's string length is > 1
Title: Re: Name with _ like in roleplay
Post by: Luis_Labarca on Jul 28, 2016, 07:09 AM
I use this in my rp

if (player.Name.find( "_" ) == null){
MessagePlayer( "[#FFFFFF]Porfavor usa el formato correcto: Nombre_Apellido", player );
MessagePlayer( "[#FFFFFF]Vuelve a entrar con el formato indicado.", player );
KickPlayer( player );
}
Title: Re: Name with _ like in roleplay
Post by: EK.IceFlake on Jul 28, 2016, 07:40 AM
Quote from: aXXo on Jul 27, 2016, 07:45 PMSplit player name with _
Make sure, the number of tokens == 2
Make sure both token's string length is > 1
function CPlayer::IsNiceName()
try
{
    local sSplitName = Name.split("_");
    if (sSplitName.len() != 2) return 0;
    if (sSplitName[0].len() > 1 && sSplitName[1].len() > 1) return 1;
}
catch (e)
{
    return 0;
}
Usage:
int CPlayer.IsNiceName()
if (CPlayer.IsNiceName() == 0) //fuck this player up, how dare he choose this shitty and ridiculous name!!!
Title: Re: Name with _ like in roleplay
Post by: Kewun on Jul 28, 2016, 10:02 AM
thx all, worked