LeetRomania Posted May 19, 2017 Report Share Posted May 19, 2017 (edited) Salut. Am aceasta functie: stock SS(playerid, color, lrom[], leng[]) { switch(playerVariables[playerid][pLimba]) { case 1: S(playerid, color, lrom); case 2: S(playerid, color, leng); } return 1; } De exemplu daca scriu SS trimit mesaj dublu ro/eng -> SS(playerid, -1, "Salut!", "Hello"); Eu doresc sa creez o functie care sa fie SSS care sa fie ca un string dar nu stiu cum. Ceva de genul format(string, sizeof(string), "Salut %s", "Hello %s", Nume(playerid); S(playerid, -1, string); Aveti idee cum pot face asta? Edited May 19, 2017 by LeetRomania Link to comment Share on other sites More sharing options...
0 Banditul Posted May 20, 2017 Report Share Posted May 20, 2017 new string1[144], string2[144]; format(string1, sizeof(string1), "Salut %s", Nume(playerid)); format(string2, sizeof(string2), "Hello %s", Nume(playerid)); S(playerid, -1, string1,string2); Sau te folosesti de y_languages http://forum.sa-mp.com/showthread.php?t=570943 http://wiki.sa-mp.com/wiki/YSI:Text Link to comment Share on other sites More sharing options...
0 LeetRomania Posted May 20, 2017 Author Report Share Posted May 20, 2017 13 hours ago, Banditul said: new string1[144], string2[144]; format(string1, sizeof(string1), "Salut %s", Nume(playerid)); format(string2, sizeof(string2), "Hello %s", Nume(playerid)); S(playerid, -1, string1,string2); Sau te folosesti de y_languages http://forum.sa-mp.com/showthread.php?t=570943 http://wiki.sa-mp.com/wiki/YSI:Text Nu ai idee cum fac sa fie dupa modelul postat de mine? Gen ala cu SSS? Link to comment Share on other sites More sharing options...
0 Banditul Posted May 20, 2017 Report Share Posted May 20, 2017 (edited) Pentru aia trebuie sa rescrii functia format. Si sincer habar nu am cum o poti rescrie(adica sa faci alta). Edited May 20, 2017 by Banditul Link to comment Share on other sites More sharing options...
0 StrikerM Posted May 20, 2017 Report Share Posted May 20, 2017 Da mesajul care iti scrie tie in chat cand scrii tu SS si da toata linia cu SCM sau cum il ai tu Etc... Ce inseamna cuvantul "Unic" este atunci cand Chestia / Obiectul / Idea / etc... nu exista in alta parte. Copii, nu mai veniti cu vorbe de "Am gamemode unic", nu exista asa ceva, la ora actuala totul este pe net. Aveti grija pe cine ajutati, majoritatea sunt caini. Link to comment Share on other sites More sharing options...
0 LeetRomania Posted May 20, 2017 Author Report Share Posted May 20, 2017 19 minutes ago, StR_Marian said: Da mesajul care iti scrie tie in chat cand scrii tu SS si da toata linia cu SCM sau cum il ai tu Etc... Folosesc SS pentru a trimite un mesaj in ro si eng iar S doar pentru un mesaj de ex: SS(playerid, -1, "Salut", "Hello"); si S(playerid, -1, "Salut")"; Link to comment Share on other sites More sharing options...
0 StrikerM Posted May 20, 2017 Report Share Posted May 20, 2017 Acum 4 minute, LeetRomania a spus: Folosesc SS pentru a trimite un mesaj in ro si eng iar S doar pentru un mesaj de ex: SS(playerid, -1, "Salut", "Hello"); si S(playerid, -1, "Salut")"; #define SS(%0,%1,%2,%3) format(str, sizeof(str),%2,%3) && SendClientMessage(%0, %1, str) SS(playerid, -1, "Salut", "Hello"); ia incearca asa Ce inseamna cuvantul "Unic" este atunci cand Chestia / Obiectul / Idea / etc... nu exista in alta parte. Copii, nu mai veniti cu vorbe de "Am gamemode unic", nu exista asa ceva, la ora actuala totul este pe net. Aveti grija pe cine ajutati, majoritatea sunt caini. Link to comment Share on other sites More sharing options...
0 LeetRomania Posted May 20, 2017 Author Report Share Posted May 20, 2017 9 minutes ago, StR_Marian said: #define SS(%0,%1,%2,%3) format(str, sizeof(str),%2,%3) && SendClientMessage(%0, %1, str) SS(playerid, -1, "Salut", "Hello"); ia incearca asa Imi da crash pawno daca pun acel define :))) Link to comment Share on other sites More sharing options...
0 StrikerM Posted May 20, 2017 Report Share Posted May 20, 2017 (edited) Acum 7 minute, LeetRomania a spus: Imi da crash pawno daca pun acel define :))) ia vezi CMD:ss(playerid,params[]) { new lrom[255], leng[255]; switch(playerVariables[playerid][pLimba]) { case 1: { format(string, 256, "Salut %s", Nume(playerid); SendClientMessage(playerid, COLOR_GREY); } case 2: { format(string, 256, "Salut %s", Nume(playerid); SendClientMessage(playerid, COLOR_GREY); } } return 1; }[/CODE] mai mult nu te pot ajuta poate iti vin idei de aici cum sa faci alt fel sincer la ora asta nu prea am idei si ma uitam si la film Edited May 20, 2017 by StR_Marian Ce inseamna cuvantul "Unic" este atunci cand Chestia / Obiectul / Idea / etc... nu exista in alta parte. Copii, nu mai veniti cu vorbe de "Am gamemode unic", nu exista asa ceva, la ora actuala totul este pe net. Aveti grija pe cine ajutati, majoritatea sunt caini. Link to comment Share on other sites More sharing options...
0 LeetRomania Posted May 21, 2017 Author Report Share Posted May 21, 2017 17 hours ago, StR_Marian said: ia vezi CMD:ss(playerid,params[]) { new lrom[255], leng[255]; switch(playerVariables[playerid][pLimba]) { case 1: { format(string, 256, "Salut %s", Nume(playerid); SendClientMessage(playerid, COLOR_GREY); } case 2: { format(string, 256, "Salut %s", Nume(playerid); SendClientMessage(playerid, COLOR_GREY); } } return 1; }[/CODE] mai mult nu te pot ajuta poate iti vin idei de aici cum sa faci alt fel sincer la ora asta nu prea am idei si ma uitam si la film Ms de raspuns dar nu ma ajuta.. Asta fac si eu folosind case. Dar eu vreau sa fie cat mai simplu sa nu consume multe linii si sa fie sub forma SSS(playerid, -1, "Salut %s", "Hello %s", Nume(playerid)); Link to comment Share on other sites More sharing options...
0 CritteR Posted May 21, 2017 Report Share Posted May 21, 2017 #define SSS(%0,%1,%2,%3,%4) format(str, sizeof(str),%2,%4) && format(str2, sizeof(str2),%3,%4) && SS(%0, %1, str, str2) //cred ca la asta te refereai //a mers compilat in new.pwn cu sublime text 3 %0 - id player %1 - culoare %2 - primul text %3 - alt doilea text %4 - unicul argument din format //limitari: poti pune un singur argument la format. 1 GitHub | Site Personal | Forum Gaming Link to comment Share on other sites More sharing options...
0 LeetRomania Posted May 21, 2017 Author Report Share Posted May 21, 2017 36 minutes ago, CritteR said: #define SSS(%0,%1,%2,%3,%4) format(str, sizeof(str),%2,%4) && format(str2, sizeof(str2),%3,%4) && SS(%0, %1, str, str2) //cred ca la asta te refereai //a mers compilat in new.pwn cu sublime text 3 %0 - id player %1 - culoare %2 - primul text %3 - alt doilea text %4 - unicul argument din format //limitari: poti pune un singur argument la format. Am facut o comanda sa testez: CMD:samp(playerid, params[]) { new mere = 1 + random(10); SSS(playerid, COLOR_RED, "%d mere.", "%d apples.", mere); return 1; } Am erorile astea: error 017: undefined symbol "str" error 017: undefined symbol "str" error 029: invalid expression, assumed zero fatal error 107: too many error messages on one line Stiu de ce am erorile dar nu ar trebui sa mi le dea. Link to comment Share on other sites More sharing options...
0 Banditul Posted May 21, 2017 Report Share Posted May 21, 2017 Pui inainte de define-ul ala , new str[144],str2[144]; Link to comment Share on other sites More sharing options...
0 LeetRomania Posted May 21, 2017 Author Report Share Posted May 21, 2017 Ar trebui sa pun new str[128], str2[128] la fiecare comanda. Pot face cumva sa nu mai trebuiasca sa pun la fiecare comanda? Link to comment Share on other sites More sharing options...
0 Banditul Posted May 21, 2017 Report Share Posted May 21, 2017 (edited) Deasupra la define N-am zis la comanda, am zis deasupra la define-ul pe care ti l-a dat Edited May 21, 2017 by Banditul 1 Link to comment Share on other sites More sharing options...
0 LeetRomania Posted May 21, 2017 Author Report Share Posted May 21, 2017 Multumesc @CritteR / @Banditul. Aveti +1 amandoi. Link to comment Share on other sites More sharing options...
Question
LeetRomania
Salut. Am aceasta functie:
De exemplu daca scriu SS trimit mesaj dublu ro/eng -> SS(playerid, -1, "Salut!", "Hello");
Eu doresc sa creez o functie care sa fie SSS care sa fie ca un string dar nu stiu cum. Ceva de genul
Aveti idee cum pot face asta?
Edited by LeetRomaniaLink to comment
Share on other sites
15 answers to this question
Recommended Posts