Jump to content

Recommended Posts

Posted

Salut, te poti folosii de functia SetPlayerName ("SetPlayerName(playerid, const name[])").

Faci comanda /acover, si pui sscanf.

Exemplu:

cmd:acover(playerid, params[]) {

new name[30];

verificam daca a folosit comanda /acover sa ii dea un astfel de mesaj in caz ca nu a pus si al doilea string ("[cover name]") --> if(sscanf(params, "s[25]",name)) return SCM(playerid, COLOR_GREY, "CMD: {FFFFFF}/acover [cover name]");

facem o verificare daca cover name-ul depaseste limita setata de catre samp implicita (1-24 de caractere), sa ii returneze pe chat un mesaj >> if(strlen(name)< 1 || strlen(name) > 24) return SendClientMessage(playerid, COLOR_WHITE, "[EROARE]: Introdu un nume cuprins intre 1-24 caractere.");

SetPlayerColor(playerid, -1); <-- ii setam culoarea numelui.
SetPlayerSkin(playerid, 1+random(100)); <-- ii dam un skin random la jucator.
SetPlayerName(playerid, name); <-- setam numele.

new string[128]; <-- cream o variabila noua pe care dorim sa o formatam pentru mesajul de jos care ne va spune ca totul a functionat bine si cu ce nume suntem sub acoperire.

format(string, sizeof(string), "[ACOVER]: Incepand de acum esti sub acoperire sub numele de %s.", name); <-- este optional acest cod, aici doar ii spune pe chat daca totul a functionat cu succes si ii spune cu ce nume este jucatorul acum sub acoperire

SCM(playerid, COLOR_WHITE, string); <-- aici trimitem pe chat string-ul pe care l-am formatat mai sus.

return 1; <-- aici returnezi

}

Sper ca ti-a fost de folos acest tutorial, spor <3.

unknown.png

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.