[Pomoc] Chatovi

Započeo DeBlack, Avgust 04, 2011, 11:46:19 PRE PODNE

prethodna tema - sledeća tema

0 članova i 2 gostiju pregledaju ovu temu.

Skripta koju koristim: Poceo sam svoju
Detaljan opis problema: Pa ja sam napravio (/g)amemaster , (/a)dmin i (/he)ad admin chat...i kada Head admin napise u /a ili /g pise Head Admin ......: ............., ali ima neki problem ( erora nema, to je u redu ), kada sebi  dadnem GM-a lvl 1 i kada u /g chat napisem nesta pise mi opet Head admin .......: ........... umjesto  da pise GameMaster ... : ...... Tako i za admin chat..umjesto da pise npr. 1 Admin ........ : ........ ono pise Head Admin ..... : .......  Evo sada sam provjeravo i uopce nemogu pisat na /a i /g ni /he...sada gledajte sliku, a ja bi  da kada npr admin lvl 1 u /g napise nesto da pise 1 Admin ... : ......... al neide....
Dio skripte:
   if(strcmp(cmd, "/admin", true) == 0 || strcmp(cmd, "/a", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "Koristite: (/a)dmin [admin chat]");
return 1;
}
format(string, sizeof(string), "*%d Admin %s: {FFFFFF}%s", PlayerInfo[playerid][pAdmin], sendername, result);
format(string, sizeof(string), "%Head Admin %s: {FFFFFF}%s", PlayerInfo[playerid][pAdmin], sendername, result);
if (PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pAdmin] >= 1)
{
SendAdminMessage(COLOR_LIGHTBLUE, string);
}
printf("Admin %s: %s", sendername, result);
}
return 1;
}

if(strcmp(cmd, "/he", true) == 0 || strcmp(cmd, "/headadmin", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "Koristite: (/he)ad admin [head admin chat]");
return 1;
}
format(string, sizeof(string), "Head Admin %s: {FFFFFF}%s", PlayerInfo[playerid][pAdmin], sendername, result);
if (PlayerInfo[playerid][pAdmin] >= 1338)
{
SendAdminMessage(COLOR_LIGHTRED, string);
}
printf("Head Admin %s: %s", sendername, result);
}
return 1;
}


if(strcmp(cmd, "/g", true) == 0 || strcmp(cmd, "/gamemaster", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "Koristite: (/g)amemaster chat]");
return 1;
}
format(string, sizeof(string), "%d GameMaster %s: {FFFFFF}%s", PlayerInfo[playerid][pGameMaster], sendername, result);
format(string, sizeof(string), "*%d Admin %s: {FFFFFF}%s", PlayerInfo[playerid][pAdmin], sendername, result);
format(string, sizeof(string), "Head Admin %s: {FFFFFF}%s", PlayerInfo[playerid][pAdmin], sendername, result);
if (PlayerInfo[playerid][pGameMaster] >= 1 || PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pAdmin] >= 1338)
{
SendGameMasterMessage(COLOR_LIGHTGREEN, string);
}
printf("GameMaster %s: %s", sendername, result);
}
return 1;
}

Neke slike/video za lakse dobivanje pomoci(neobavezno): http://www.zaslike.com/files/lmjn1vg6ping837qrbw.png  - eto vidi se da sam admin lvl 1 a pise head admin, i jos jedna greska, nemogu pisat u /a 7g i /he chat, pise moje ime -.- ..........
      
DeBlack | Mapper | PS User

Evo ti ovako stavljaj ovako je najbolje  :D


//----------------------------------[AdminChat]-----------------------------------------------
if(strcmp(cmd, "/admin", true) == 0 || strcmp(cmd, "/a", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[128];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "{F81414}Balkan Mafia {00C0FF}Komanda | /a [admin chat]");
return 1;
}

new arank[64];
if(PlayerInfo[playerid][pAdmin] == 1) { arank = "Admin LvL 1"; } //
else if(PlayerInfo[playerid][pAdmin] == 2) { arank = "Admin LvL 2"; } //
else if(PlayerInfo[playerid][pAdmin] == 3) { arank = "Admin LvL 3"; } //
else if(PlayerInfo[playerid][pAdmin] == 4) { arank = "Admin LvL 4"; } //
else if(PlayerInfo[playerid][pAdmin] == 1337) { arank = "Co-Administrator"; } //
else if(PlayerInfo[playerid][pAdmin] == 1338) { arank = "Head Administrator"; } // Ti ovdje jos mozes dodavati .. samo kopiras else if itd.
else { arank = "Unknown"; }

format(string, sizeof(string), "[ %s ] %s kaze:%s ", arank, sendername, result);
if (PlayerInfo[playerid][pAdmin] >= 1)
{
SendAdminMessage(COLOR_LIGHTRED, string);
}
printf("Admin %s: %s", sendername, result);
new y, m, d;
new h,mi,s;
getdate(y,m,d);
gettime(h,mi,s);
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] Admin %s: %s",d,m,y,h,mi,s,sendername, result);
AdminChatLog(string);
}
return 1;
}

Kod mene to tvoje nevalja, imas error [ kod AdminChatLog(string); ].......a i kako vidim tu nema Gamemaster chat i head admin chat
Poslednja Izmena: Avgust 04, 2011, 12:59:40 POSLE PODNE od DeBlack
      
DeBlack | Mapper | PS User


Evo ti ovako ....

+ Ti dodajes sebi head admin chat itd. umisto pAdmin ti stavis pGameMaster ( ako oces gamemaster itd. ) skuzi malo komanda je laka.


//----------------------------------[AdminChat]-----------------------------------------------
if(strcmp(cmd, "/admin", true) == 0 || strcmp(cmd, "/a", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[128];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "{F81414}Balkan Mafia {00C0FF}Komanda | /a [admin chat]");
return 1;
}

new arank[64];
if(PlayerInfo[playerid][pAdmin] == 1) { arank = "Admin LvL 1"; } //
else if(PlayerInfo[playerid][pAdmin] == 2) { arank = "Admin LvL 2"; } //
else if(PlayerInfo[playerid][pAdmin] == 3) { arank = "Admin LvL 3"; } //
else if(PlayerInfo[playerid][pAdmin] == 4) { arank = "Admin LvL 4"; } //
else if(PlayerInfo[playerid][pAdmin] == 1337) { arank = "Co-Administrator"; } //
else if(PlayerInfo[playerid][pAdmin] == 1338) { arank = "Head Administrator"; } // Ti ovdje jos mozes dodavati .. samo kopiras else if itd.
else { arank = "Unknown"; }

format(string, sizeof(string), "[ %s ] %s kaze:%s ", arank, sendername, result);
if (PlayerInfo[playerid][pAdmin] >= 1)
{
SendAdminMessage(COLOR_LIGHTRED, string);
}
printf("Admin %s: %s", sendername, result);
new y, m, d;
new h,mi,s;
getdate(y,m,d);
gettime(h,mi,s);
}
return 1;
}


Aha, thx, znam ja to napravit, i ono moje sam bio pravio pa sam nest zabrljo na kraju....Moze lock...
      
DeBlack | Mapper | PS User

//----------------------------------[AdminChat]-----------------------------------------------
if(strcmp(cmd, "/admin", true) == 0 || strcmp(cmd, "/a", true) == 0)
{
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[128];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "{F81414}Balkan Mafia {00C0FF}Komanda | /a [admin chat]");
return 1;
}
new arank[26];
if(PlayerInfo[playerid][pAdmin] == 1) { arank = "Admin LvL 1"; } //
else if(PlayerInfo[playerid][pAdmin] == 2) { arank = "Admin LvL 2"; } //
else if(PlayerInfo[playerid][pAdmin] == 3) { arank = "Admin LvL 3"; } //
else if(PlayerInfo[playerid][pAdmin] == 4) { arank = "Admin LvL 4"; } //
else if(PlayerInfo[playerid][pAdmin] == 1337) { arank = "Co-Administrator"; } //
else if(PlayerInfo[playerid][pAdmin] == 1338) { arank = "Head Administrator"; } // Ti ovdje jos mozes dodavati .. samo kopiras else if itd.
else { arank = "Unknown"; }
format(string, sizeof(string), "[ %s ] %s kaze:%s ", arank, sendername, result);
if (PlayerInfo[playerid][pAdmin] >= 1)
{
SendAdminMessage(COLOR_LIGHTRED, string);
}
printf("Admin %s: %s", sendername, result);
}


Stavi ovako, obrisane bezvezne varijable.
Aequam memento rebus in arduis servare mentem.

SoNNix

Citat: [GG] LuKsA poslato Avgust 04, 2011, 15:10:01 POSLE PODNE
//----------------------------------[AdminChat]-----------------------------------------------
if(strcmp(cmd, "/admin", true) == 0 || strcmp(cmd, "/a", true) == 0)
{
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[128];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "{F81414}Balkan Mafia {00C0FF}Komanda | /a [admin chat]");
return 1;
}
new arank[26];
if(PlayerInfo[playerid][pAdmin] == 1) { arank = "Admin LvL 1"; } //
else if(PlayerInfo[playerid][pAdmin] == 2) { arank = "Admin LvL 2"; } //
else if(PlayerInfo[playerid][pAdmin] == 3) { arank = "Admin LvL 3"; } //
else if(PlayerInfo[playerid][pAdmin] == 4) { arank = "Admin LvL 4"; } //
else if(PlayerInfo[playerid][pAdmin] == 1337) { arank = "Co-Administrator"; } //
else if(PlayerInfo[playerid][pAdmin] == 1338) { arank = "Head Administrator"; } // Ti ovdje jos mozes dodavati .. samo kopiras else if itd.
else { arank = "Unknown"; }
format(string, sizeof(string), "[ %s ] %s kaze:%s ", arank, sendername, result);
if (PlayerInfo[playerid][pAdmin] >= 1)
{
SendAdminMessage(COLOR_LIGHTRED, string);
}
printf("Admin %s: %s", sendername, result);
}


Stavi ovako, obrisane bezvezne varijable.

ja mislim da je ovako bolje...


//----------------------------------[AdminChat]-----------------------------------------------
if(strcmp(cmd, "/admin", true) == 0 || strcmp(cmd, "/a", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[128];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "{F81414}Balkan Mafia {00C0FF}Komanda | /a [admin chat]");
return 1;
}

new arank[64];
if(PlayerInfo[playerid][pAdmin] == 1) { arank = "Admin LvL 1"; } //
else if(PlayerInfo[playerid][pAdmin] == 2) { arank = "Admin LvL 2"; } //
else if(PlayerInfo[playerid][pAdmin] == 3) { arank = "Admin LvL 3"; } //
else if(PlayerInfo[playerid][pAdmin] == 4) { arank = "Admin LvL 4"; } //
else if(PlayerInfo[playerid][pAdmin] == 1337) { arank = "Co-Administrator"; } //
else if(PlayerInfo[playerid][pAdmin] == 1338) { arank = "Head Administrator"; } // Ti ovdje jos mozes dodavati .. samo kopiras else if itd.
else { arank = "Unknown"; }

format(string, sizeof(string), "[ %s ] %s kaze:%s ", arank, sendername, result);
if (PlayerInfo[playerid][pAdmin] >= 1)
{
SendAdminMessage(COLOR_LIGHTRED, string);
}
printf("Admin %s: %s", sendername, result);
new y, m, d;
new h,mi,s;
getdate(y,m,d);
gettime(h,mi,s);
}
return 1;
}


[/quote]

SoNNix nije bolje i ne pricaj gluposti -.-
Aequam memento rebus in arduis servare mentem.

SoNNix

sta odmah da pricam gluposti,samo sam rekao nemoras odmah da pricam gluposti xDD...sve je bolje od drugis sta ti napravis...ali ono nevalja???

Nisam to rekao, valja ono ali je moj kod bolji, tj. optimiziraniji i obrisane su nepotrebne varijable..
Aequam memento rebus in arduis servare mentem.

SoNNix

pa ja nisam rekao da tvoj kod nije u redu,ali mi se vise svida oni...ti si sve to ukratko xDD

Momci vi sta ste mi sada dali nevalja 2 pare..evo vam slike kako izgleda kada napisem nesto....sva 3 primjera nevaljaju

Evo kako pise kada napisem u /a - http://www.zaslike.com/files/2ssgzmt3dz04o4eqjsc.png  - uopce nepise moje ime -.-

Ipak cu sam sebi morat radit..mozete lock ovo
      
DeBlack | Mapper | PS User