Jump to content


Recommended Posts

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

Faci comanda /acover, si pui sscanf.


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.


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • 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.