Balkan SA:MP

PAWN skriptanje, gamemodovi, filterskripte, include fajlovi, mape, pluginovi => Razgovor u vezi PAWN - skriptanja => Temu započeo: ZivaSila123 poslato Januar 17, 2016, 12:53:05 POSLE PODNE

Naslov: [Pomoc] Jedno Ime
Poruka od: ZivaSila123 poslato Januar 17, 2016, 12:53:05 POSLE PODNE
Skripta koju koristim: Srbija gaming
Detaljan opis problema: Kako da stavim da mogu jedno ime ?
Dio skripte:
evo onplayerconnect
[pawn]new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    if(!IsRPName(name) || !NameValidator(playerid))
   {
        SendServerMessage(playerid, "Vase ime nije prihvatljivo.");
      SendServerMessage(playerid, "(( Vase ime mora da bude u formatu Ime_Prezime. ))");
      KickPL(playerid);
      return 1;
     }[/pawn]
Neke slike/video za lakse dobivanje pomoci(neobavezno)://
Naslov: Odg: [Pomoc] Jedno Ime
Poruka od: LAVendeta poslato Januar 17, 2016, 12:57:24 POSLE PODNE
Nisam bas razumeo.Ti imas kod koji proverava da kad se igrac konektuje da li mu je ime RP.
A zelis da mozu uci i ljudi koji imaju i obicno ime?(nonRp)?
Naslov: Odg: [Pomoc] Jedno Ime
Poruka od: ZivaSila123 poslato Januar 17, 2016, 13:10:13 POSLE PODNE
Da evo to nonrp
[pawn]stock IsRPName(const name[], max_underscores = 2)
{
    new underscores = 0;
    if (name[0] < 'A' || name[0] > 'Z') return false; // First letter is not capital
    for(new i = 1; i < strlen(name); i++)
    {
        if(name != '_' && (name < 'A' || name > 'Z') && (name < 'a' || name > 'z')) return false; // a-zA-Z_
        if( (name >= 'A' && name <= 'Z') && (name[i - 1] != '_') ) return false; // unneeded capital letter
        if(name == '_')
        {
            underscores++;
            if(underscores > max_underscores || i == strlen(name)) return false; // More underlines than limit, or underline at the last pos
            if(name[i + 1] < 'A' || name[i + 1] > 'Z') return false; // Not a capital letter after underline
        }
    }
    if (underscores == 0) return false; // No underline detected
    return true;
}

stock NameValidator(playerid)
{
    new pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    if(strfind(pname,"Jebem",true) != (-1)) return 0;
    else if(strfind(pname,"Kurac",true) != (-1)) return 0;
    else if(strfind(pname,"Picka",true) != (-1)) return 0;
    else if(strfind(pname,"Retard",true) != (-1)) return 0;
    else if(strfind(pname,"Debil",true) != (-1)) return 0;
    else if(strfind(pname,"Majmun",true) != (-1)) return 0;
    else if(strfind(pname,"Proliv",true) != (-1)) return 0;
    else if(strfind(pname,"Karina",true) != (-1)) return 0;
    else if(strfind(pname,"Spray",true) != (-1)) return 0;
    else if(strfind(pname,"Player",true) != (-1)) return 0;
    else if(strfind(pname,"Igrac",true) != (-1)) return 0;
    else if(strfind(pname,"Tag",true) != (-1)) return 0;
    else if(strfind(pname,"Admin",true) != (-1)) return 0;
    else if(strfind(pname,"Promoter",true) != (-1)) return 0;
    else if(strfind(pname,"Supporter",true) != (-1)) return 0;
    else if(strfind(pname,"Dupe",true) != (-1)) return 0;
    return 1;
}[/pawn]
Naslov: Odg: [Pomoc] Jedno Ime
Poruka od: Arkoo poslato Januar 17, 2016, 13:27:06 POSLE PODNE
Iskljuci tu provjeru i ubaci ovu obicnu, dodaj na onplayerconnect
[pawn]

   new plnames[MAX_PLAYER_NAME];
   GetPlayerName(playerid, plnames, sizeof(plnames));
   new namestring = strfind(plnames, "_", true);
        new IME = strfind(plname, "IME", true);
   if(IME == -1 && namestring == -1)
   {
   SCM(playerid, -1, ""SPLAVA"Vase ime mora biti u formatu {FFFFFF}Ime_Prezime");
   Kick(playerid);
   return 1;
   }



[/pawn]
Naslov: Odg: [Pomoc] Jedno Ime
Poruka od: LAVendeta poslato Januar 17, 2016, 14:28:30 POSLE PODNE
Pa ako neces da proverava da li je RP ime samo izbrisi to sve.
Naslov: Odg: [Pomoc] Jedno Ime
Poruka od: #Pheonix poslato Januar 17, 2016, 17:47:26 POSLE PODNE
I ja koristim taj mod, izbrisi tu proveru i koristi se regexom malo, lakse je za koristiti
Naslov: Odg: [Pomoc] Jedno Ime
Poruka od: ZivaSila123 poslato Januar 17, 2016, 20:30:24 POSLE PODNE
Sta sa regexom mozes malo da pojasnis...
Naslov: Odg: [Pomoc] Jedno Ime
Poruka od: ZivaSila123 poslato Januar 18, 2016, 09:51:36 PRE PODNE
Zna neko ??
Naslov: Odg: [Pomoc] Jedno Ime
Poruka od: ZivaSila123 poslato Januar 19, 2016, 23:15:22 POSLE PODNE
BUMP!