Wysłany: 2016-07-29, 03:38
JestemSuperLIKE
Początkujący grafik
Wiek: 27 Na forum: 3694 dni Posty: 133
Piwa : 6
Jak mam napisa? rangi z kolorami i ID, jeszcze jak mam napisa? np. mam rang? head admin a daje graczowi rang? na admina i ta ranga samo si? zmienia z gracz na admin.
Chodzi mi rang? z kolorem czerwonym np. (Head Admin ID:2).
PS: Zmiany rang s? w MySQL
Wysłany: 2016-07-29, 05:55
Iggy
#admin
Wiek: 26 Na forum: 4596 dni Posty: 3469
Nick w MP: Iggy
Piwa : 1716
Administrator: Admin ma zawsze rację | REGULAMIN FORUM | REKLAMA/VIP | .
Pawn
//1 - gracz, 2 - admin, 3 - head admin, przyk?adowo.
I masz praktycznie ca?y system. Nadaj?c rang? komend? zmieniasz warto?? zmiennej danemu graczowi, zapisujesz sobie to do bazy danych i ju?. P??niej jak chcesz zrobi? komend? dla admina danego levelu to sprawdzasz na pocz?tku komendy czy warto?? zmiennej ranga wynosi tyle co wymagany level. Aby przy nicku mie? dopisek head admin czy tam jaki? inny to w publicu OnPlayerText formatujesz jaki? string i tam dodajesz, w kt?rym miejscu ma by? dopisek o randze itd. (kolejno?? format?w). Najpro?ciej b?dzie jak w w/w publicu sprawdzisz, ile wynosi zmienna ranga i jak 1 to przy nicku gracza dodajesz dopisek gracz, jak 2 to admin itd.
Wysłany: 2016-07-29, 10:09
kazami
Pawner/PTG
Wiek: 27 Na forum: 4596 dni Posty: 405
Nick w MP: adi888
Piwa : 43
Jeszcze tak aby nie zawala? zb?dnymi zmiennymi GM zr?b u g?ry
Pawn
#undef MAX_PLAYERS
#define MAX_PLAYERS twoja_ilosc_slot np:
#define MAX_PLAYERS 30
Co do twojej propozycji Iggy jest dobra ale czemu robi? to w ten spos?b a nie w enum to wpina? ?
Wysłany: 2016-07-29, 17:47
JestemSuperLIKE
Początkujący grafik
Wiek: 27 Na forum: 3694 dni Posty: 133
Piwa : 6
Pr?buje 100 razy i wyskakuj? mi same b??dy, chcia?em doda? rangi do gm z tego linku: Kod: http://gtao.pl/%3Cfont-color33ccff%3Edm%3C-font%3E-ultimate-deathmatch-v26-vt99464.htm
To jest kod z Public OnPlayerText
Kod:
public OnPlayerText(playerid, text[])
{
if(!Logged[playerid] || !text[0] || isnull(text)) return 0;
if(!strcmp(SlowoRozsypanka, text, true) && strlen(text) == strlen(SlowoRozsypanka) && wyrazTrwa) return cmd_wyraz(playerid, text), 0;
if(!strcmp(SlowoKod, text) && strlen(text) == strlen(SlowoKod) && kodTrwa) return cmd_kod(playerid, text), 0;
if(!strcmp(lastMessage[playerid], text, true, 12)) return playerMessage(playerid, C_INFO, "Nie powtarzaj ostatniej wiadomo?ci!", "Don't repeat the last message!", 0);
if(mathResult != -897234 && strval(text) == mathResult) return cmd_wynik(playerid, text), 0;
if(puzzleTime != -1 && !strcmp(puzzleAnswer, text, true)) return cmd_odpowiedz(playerid, text), 0;
if(jTime[playerid]) return playerMessage(playerid, C_RED, "W wi?zieniu nie wolno pisa? na czacie!", "In prison you can't use chat!", 0);
if(actualtime - lastTime[playerid] < 3 && Rank[playerid] < 2)
{
lastTime[playerid] = actualtime - 2;
return playerMessage(playerid, C_RED, "Musisz odczeka? "WHITE"2 "RED"sekundy od wys?ania poprzedniej wiadomo?ci!", "You must to wait "WHITE"2 "RED"seconds from sending last message!", 0);
}
if(cTime[playerid]) Loop(letterid, strlen(text)) if(65 <= text[letterid] <= 90) text[letterid] += 32;
new s[300], resultid, theSpace, gangid = pGang[playerid];
format(lastMessage[playerid], 12, text);
lastTime[playerid] = actualtime;
if(gangid != -1)
{
new allyid = gAlly[gangid];
if(text[0] == '!')
{
format(s, 300, "[GANG CHAT] {%06x}%s "WHITE"(%s): %s", GetPlayerColor(playerid) >>> 8, pName[playerid], gangRangName[gRang[playerid]], text[1]);
foreach(new actionid: peopleGang[gangid]) longMessage(actionid, C_LGREEN, s);
writeLog("[GANG CHAT - %s] %s (%d): %s", gName[gangid], pName[playerid], playerid, text); return 0;
}
else if(text[0] == '$' && allyid != -1)
{
format(s, 300, "[ALLY CHAT] {%06x}%s "WHITE"(%s): %s", GetPlayerColor(playerid) >>> 8, pName[playerid], gangRangName[gRang[playerid]], text[1]);
foreach(new actionid: peopleGang[gangid]) longMessage(actionid, C_LGREEN, s);
foreach(new actionid: peopleGang[allyid]) longMessage(actionid, C_LGREEN, s);
writeLog("[ALLY CHAT - %s] %s (%d): %s", gName[gangid], pName[playerid], playerid, text); return 0;
}
}
if(teamEvent(OnGame[playerid]) && text[0] == '#')
{
format(s, 300, "[TEAM CHAT] {%06x}%s"WHITE": %s", GetPlayerColor(playerid) >>> 8, pName[playerid], text[1]);
gameLoop(actionid, OnGame[playerid])
{
if(gameTeam[actionid] == gameTeam[playerid]) longMessage(actionid, -1, s);
}
return 0;
}
if(text[0] == '@' && Rank[playerid])
{
switch(Rank[playerid])
{
case 1:
{
format(s, 300, "[VIP CHAT] {%06x}%s"WHITE": %s", GetPlayerColor(playerid) >>> 8, pName[playerid], text[1]);
foreach(new actionid: Vip)
{
SCM(actionid, C_YELLOW, s);
}
writeLog("[VIP CHAT] %s (%d): %s", pName[playerid], playerid, text);
}
case 2, 3, 4:
{
format(s, 300, "[ADMIN CHAT] {%06x}%s"WHITE": %s", GetPlayerColor(playerid) >>> 8, pName[playerid], text[1]);
foreach(new actionid: Admin)
{
SCM(actionid, C_GREEN, s);
}
writeLog("[ADMIN CHAT] %s (%d): %s", pName[playerid], playerid, text);
}
}
return 0;
}
if(mTime[playerid])
{
unixTimeToData(mTime[playerid], s);
return playerMessageEx(playerid, C_VIOLET, "Jeste? uciszony! Nie wolno Ci pisa? na czacie przez "WHITE"%s!", "You are muted! You can't write on the chat for "WHITE"%s!", s), 0;
}
if(Rank[playerid] < 2)
{
if(!sscanf(text, "P< .:>a<i>[5]", unusedInteger))
{
printf("Advertisement! (%s) (%s)", pName[playerid], text);
format(s, 300, "%d {%06x}%s: {%06x}%s", playerid, GetPlayerColor(playerid) >>> 8, pName[playerid], rangColor[Rank[playerid]] >>> 8, text);
return longMessage(playerid, C_GREY, s, rangColor[Rank[playerid]]), 0;
}
}
Loop(wordid, sizeof badWords)
{
while((resultid = strfind(text, badWords[wordid], true)) > -1)
{
if((theSpace = strfind(text, " ", true, resultid)) == -1) theSpace = strlen(text);
strdel(text, resultid, theSpace);
strins(text, "**", resultid, 64);
}
}
format(s, 300, "%d {%06x}%s: {%06x}%s", playerid, GetPlayerColor(playerid) >>> 8, pName[playerid], rangColor[Rank[playerid]] >>> 8, text);
longMessageToAll(C_GREY, s, rangColor[Rank[playerid]]);
return writeLog("[TEXT] %s (%d): %s", pName[playerid], playerid, text), 0;
}
Wysłany: 2016-07-29, 19:57
Iggy
#admin
Wiek: 26 Na forum: 4596 dni Posty: 3469
Nick w MP: Iggy
Piwa : 1716
Administrator: Admin ma zawsze rację | REGULAMIN FORUM | REKLAMA/VIP | .
JestemSuperLIKE , w tym kodzie jest troch? wi?cej rzeczy ni? same rangi. Poka?? Ci tutaj przyk?adowo, jak to ma dzia?a?.
Pawn public OnPlayerText ( playerid , text [])
{
if( ranga [ playerid ] == 1 ) //zwyk?y gracz
{
new string [ 150 ];
format ( string , 150 , "%s(ID:%d) Gracz: %s" , PlayerName ( playerid ), playerid , text );
SendClientMessageToAll (- 1 , string );
return 0 ;
}
else if( ranga [ playerid ] == 2 ) //admin
{
new string [ 150 ];
format ( string , 150 , "%s(ID:%d) Admin: %s" , PlayerName ( playerid ), playerid , text );
SendClientMessageToAll (- 1 , string );
return 0 ;
}
else if( ranga [ playerid ] == 3 ) //head admin
{
new string [ 150 ];
format ( string , 150 , "%s(ID:%d) Head Admin: %s" , PlayerName ( playerid ), playerid , text );
SendClientMessageToAll (- 1 , string );
return 0 ;
}
return 0 ;
}
"kazami" napisał/a :Co do twojej propozycji Iggy jest dobra ale czemu robi? to w ten spos?b a nie w enum to wpina? ?
Ta opcja jest uniwersalna, tworz?c zmienn? dla wszystkich graczy zadzia?a to zawsze, nie wiem czy autor w?tku korzysta z enuma, czy po prostu zwyk?ych zmiennych, poza tym to tylko przyk?ad dzia?ania tego, jak zrobi sobie to autor tematu to ju? jego sprawa.
Wysłany: 2016-07-29, 20:48
JestemSuperLIKE
Początkujący grafik
Wiek: 27 Na forum: 3694 dni Posty: 133
Piwa : 6
Mam 4 b??d?w i 2 Warming?w i jak je naprawi??
Da?em definicje do def.inc, a new Rank[MAX_PLAYERS] i kod z tymi rangami da?em do function.inc
Kod:
UltimateDM2/functions.inc(1) : error 021: symbol already defined: "Rank"
UltimateDM2/functions.inc(1494) : warning 225: unreachable code
UltimateDM2/functions.inc(1494) : warning 217: loose indentation
UltimateDM2/functions.inc(1498) : error 017: undefined symbol "PlayerName"
UltimateDM2/functions.inc(1505) : error 017: undefined symbol "PlayerName"
UltimateDM2/functions.inc(1512) : error 017: undefined symbol "PlayerName"
Kod z b??dami i Warmingami.
Kod:
public OnPlayerText(playerid, text[])
{
if(!Logged[playerid] || !text[0] || isnull(text)) return 0;
if(!strcmp(SlowoRozsypanka, text, true) && strlen(text) == strlen(SlowoRozsypanka) && wyrazTrwa) return cmd_wyraz(playerid, text), 0;
if(!strcmp(SlowoKod, text) && strlen(text) == strlen(SlowoKod) && kodTrwa) return cmd_kod(playerid, text), 0;
if(!strcmp(lastMessage[playerid], text, true, 12)) return playerMessage(playerid, C_INFO, "Nie powtarzaj ostatniej wiadomo?ci!", "Don't repeat the last message!", 0);
if(mathResult != -897234 && strval(text) == mathResult) return cmd_wynik(playerid, text), 0;
if(puzzleTime != -1 && !strcmp(puzzleAnswer, text, true)) return cmd_odpowiedz(playerid, text), 0;
if(jTime[playerid]) return playerMessage(playerid, C_RED, "W wi?zieniu nie wolno pisa? na czacie!", "In prison you can't use chat!", 0);
if(actualtime - lastTime[playerid] < 3 && Rank[playerid] < 2)
{
lastTime[playerid] = actualtime - 2;
return playerMessage(playerid, C_RED, "Musisz odczeka? "WHITE"2 "RED"sekundy od wys?ania poprzedniej wiadomo?ci!", "You must to wait "WHITE"2 "RED"seconds from sending last message!", 0);
}
if(cTime[playerid]) Loop(letterid, strlen(text)) if(65 <= text[letterid] <= 90) text[letterid] += 32;
new s[300], resultid, theSpace, gangid = pGang[playerid];
format(lastMessage[playerid], 12, text);
lastTime[playerid] = actualtime;
if(gangid != -1)
{
new allyid = gAlly[gangid];
if(text[0] == '!')
{
format(s, 300, "[GANG CHAT] {%06x}%s "WHITE"(%s): %s", GetPlayerColor(playerid) >>> 8, pName[playerid], gangRangName[gRang[playerid]], text[1]);
foreach(new actionid: peopleGang[gangid]) longMessage(actionid, C_LGREEN, s);
writeLog("[GANG CHAT - %s] %s (%d): %s", gName[gangid], pName[playerid], playerid, text); return 0;
}
else if(text[0] == '$' && allyid != -1)
{
format(s, 300, "[ALLY CHAT] {%06x}%s "WHITE"(%s): %s", GetPlayerColor(playerid) >>> 8, pName[playerid], gangRangName[gRang[playerid]], text[1]);
foreach(new actionid: peopleGang[gangid]) longMessage(actionid, C_LGREEN, s);
foreach(new actionid: peopleGang[allyid]) longMessage(actionid, C_LGREEN, s);
writeLog("[ALLY CHAT - %s] %s (%d): %s", gName[gangid], pName[playerid], playerid, text); return 0;
}
}
if(teamEvent(OnGame[playerid]) && text[0] == '#')
{
format(s, 300, "[TEAM CHAT] {%06x}%s"WHITE": %s", GetPlayerColor(playerid) >>> 8, pName[playerid], text[1]);
gameLoop(actionid, OnGame[playerid])
{
if(gameTeam[actionid] == gameTeam[playerid]) longMessage(actionid, -1, s);
}
return 0;
}
if(text[0] == '@' && Rank[playerid])
{
switch(Rank[playerid])
{
case 1:
{
format(s, 300, "[VIP CHAT] {%06x}%s"WHITE": %s", GetPlayerColor(playerid) >>> 8, pName[playerid], text[1]);
foreach(new actionid: Vip)
{
SCM(actionid, C_YELLOW, s);
}
writeLog("[VIP CHAT] %s (%d): %s", pName[playerid], playerid, text);
}
case 2, 3, 4:
{
format(s, 300, "[ADMIN CHAT] {%06x}%s"WHITE": %s", GetPlayerColor(playerid) >>> 8, pName[playerid], text[1]);
foreach(new actionid: Admin)
{
SCM(actionid, C_GREEN, s);
}
writeLog("[ADMIN CHAT] %s (%d): %s", pName[playerid], playerid, text);
}
}
return 0;
}
if(mTime[playerid])
{
unixTimeToData(mTime[playerid], s);
return playerMessageEx(playerid, C_VIOLET, "Jeste? uciszony! Nie wolno Ci pisa? na czacie przez "WHITE"%s!", "You are muted! You can't write on the chat for "WHITE"%s!", s), 0;
}
if(Rank[playerid] < 2)
{
if(!sscanf(text, "P< .:>a<i>[5]", unusedInteger))
{
printf("Advertisement! (%s) (%s)", pName[playerid], text);
format(s, 300, "%d {%06x}%s: {%06x}%s", playerid, GetPlayerColor(playerid) >>> 8, pName[playerid], rangColor[Rank[playerid]] >>> 8, text);
return longMessage(playerid, C_GREY, s, rangColor[Rank[playerid]]), 0;
}
}
Loop(wordid, sizeof badWords)
{
while((resultid = strfind(text, badWords[wordid], true)) > -1)
{
if((theSpace = strfind(text, " ", true, resultid)) == -1) theSpace = strlen(text);
strdel(text, resultid, theSpace);
strins(text, "**", resultid, 64);
}
}
format(s, 300, "%d {%06x}%s: {%06x}%s", playerid, GetPlayerColor(playerid) >>> 8, pName[playerid], rangColor[Rank[playerid]] >>> 8, text);
longMessageToAll(C_GREY, s, rangColor[Rank[playerid]]);
return writeLog("[TEXT] %s (%d): %s", pName[playerid], playerid, text), 0;
{
if (Rank[playerid] == 1)//zwyk?y gracz
{
new string[150];
format(string, 150, "%s(ID:%d) Gracz: %s", PlayerName(playerid), playerid, text);
SendClientMessageToAll(-1, string);
return 0;
}
else if(Rank[playerid] == 3)//admin
{
new string[150];
format(string, 150, "%s(ID:%d) Admin: %s", PlayerName(playerid), playerid, text);
SendClientMessageToAll(-1, string);
return 0;
}
else if (Rank[playerid] == 4)//head admin
{
new string[150];
format(string, 150, "%s(ID:%d) Head Admin: %s", PlayerName(playerid), playerid, text);
SendClientMessageToAll(-1, string);
return 0;
}
return 0;
}
}
Wysłany: 2016-07-30, 12:42
Iggy
#admin
Wiek: 26 Na forum: 4596 dni Posty: 3469
Nick w MP: Iggy
Piwa : 1716
Administrator: Admin ma zawsze rację | REGULAMIN FORUM | REKLAMA/VIP | .
Cytat: UltimateDM2/functions.inc(1498) : error 017: undefined symbol "PlayerName"
UltimateDM2/functions.inc(1505) : error 017: undefined symbol "PlayerName"
UltimateDM2/functions.inc(1512) : error 017: undefined symbol "PlayerName"
Gdzie? w mapie dodaj:
Pawn PlayerName ( playerid )
{
new name [ MAX_PLAYER_NAME ];
GetPlayerName ( playerid , name , MAX_PLAYER_NAME );
return name ;
}
Cytat: UltimateDM2/functions.inc(1494) : warning 217: loose indentation
?le u?o?ony kod.
Cytat: UltimateDM2/functions.inc(1) : error 021: symbol already defined: "Rank"
Masz ju? gdzie? u?yte w gm'ie "Rank".
Cytat: UltimateDM2/functions.inc(1494) : warning 225: unreachable code
Tutaj co? chyba z returnem b?dzie (wpisany nie w tym miejscu), chocia? pewien nie jestem.
Tak poza tym to widz?, ?e skopiowa?e? ca?y kod, wklei?e? i pewnie nawet nie przeanalizowa?e? co i jak dzia?a. Jest to chyba cz??? GM Combaciora, a jak tak wkleisz kod, nie usuwaj?c tych dopisk?w rang, kt?re s? w tym GM to raczej to nie zadzia?a.
Wysłany: 2016-07-30, 15:55
JestemSuperLIKE
Początkujący grafik
Wiek: 27 Na forum: 3694 dni Posty: 133
Piwa : 6
Teraz mam takie b??dy:
Kod:
UltimateDM2/functions.inc(1514) : error 021: symbol already defined: "format"
UltimateDM2/functions.inc(1516) : error 010: invalid function or declaration
UltimateDM2/functions.inc(2282) : error 025: function heading differs from prototype
C:\Users\Kamil1\Desktop\Ultimate DeathMatch\v2.6\gamemodes\new2.pwn(9307) : warning 203: symbol is never used: "longMessageToAll"
Wysłany: 2016-07-30, 16:17
Iggy
#admin
Wiek: 26 Na forum: 4596 dni Posty: 3469
Nick w MP: Iggy
Piwa : 1716
Wysłany: 2016-07-30, 16:38
JestemSuperLIKE
Początkujący grafik
Wiek: 27 Na forum: 3694 dni Posty: 133
Piwa : 6
function.inc 1514-1516.
Kod:
format(string, 150, "%s(ID:%d) Gracz: %s", PlayerName(playerid), playerid, text);
longMessageToAll(C_GREY, s, rangColor[Rank[playerid]]);
return writeLog("[TEXT] %s (%d): %s", pName[playerid], playerid, text), 0;
Wysłany: 2016-07-30, 18:17
Iggy
#admin
Wiek: 26 Na forum: 4596 dni Posty: 3469
Nick w MP: Iggy
Piwa : 1716
Administrator: Admin ma zawsze rację | REGULAMIN FORUM | REKLAMA/VIP | .
JestemSuperLIKE , namieszane tutaj wszystkiego, s? jakie? dodatkowe funkcje porobione. Pisa?em Ci, ?e wklejenie kodu tak po prostu nie zadzia?a raczej. Nie wiem jak wygl?da funkcja longMessageToAll, ale z tego co widz? to formatujesz zmienn? string, a wysy?asz s (o ile tak to dzia?a).
Wysłany: 2016-07-30, 18:42
JestemSuperLIKE
Początkujący grafik
Wiek: 27 Na forum: 3694 dni Posty: 133
Piwa : 6
To chyba ta funkcja.
Kod:
longMessageToAll(color, message[], secondcolor = -1)
{
new LimitedMsg[2][144];
if(strlen(message) > 144)
{
strmid(LimitedMsg[0], message, 0, 139);
format(LimitedMsg[0], 144, "%s", LimitedMsg[0]);
strmid(LimitedMsg[1], message, 139, strlen(message));
format(LimitedMsg[1], 144, "%s", LimitedMsg[1]);
SCMTA(color, LimitedMsg[0]);
return SCMTA(secondcolor, LimitedMsg[1]);
}
return SCMTA(color, message);
}
Wysłany: 2016-07-30, 19:20
Iggy
#admin
Wiek: 26 Na forum: 4596 dni Posty: 3469
Nick w MP: Iggy
Piwa : 1716
Administrator: Admin ma zawsze rację | REGULAMIN FORUM | REKLAMA/VIP | .
Cytat: z tego co widz? to formatujesz zmienn? string, a wysy?asz s (o ile tak to dzia?a).
Wysłany: 2016-07-30, 19:29
JestemSuperLIKE
Początkujący grafik
Wiek: 27 Na forum: 3694 dni Posty: 133
Piwa : 6
Nie wiem jak to si? robi, bo jeszcze tego nie robi?em. ;/
Wysłany: 2016-07-30, 19:59
Iggy
#admin
Wiek: 26 Na forum: 4596 dni Posty: 3469
Nick w MP: Iggy
Piwa : 1716
Administrator: Admin ma zawsze rację | REGULAMIN FORUM | REKLAMA/VIP | .
Cytat: format(string , 150, "%s(ID:%d) Gracz: %s", PlayerName(playerid), playerid, text);
longMessageToAll(C_GREY, s , rangColor[Rank[playerid]]);
Og?lnie rzecz bior?c, pisz? ju? kolejny raz, takie doklejanie kodu mija si? z celem, wszystko si? pomiesza i prawdopodobnie nie zadzia?a.
Tagi: rangi :: samp
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: