[POMOC] dialog

Započeo Marley, April 03, 2012, 20:31:12 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

Marley

Mod:BPE
Opis:ovako nisam nikad pravio dialog dosad samo SendClientMessage sam koristio xd, pa sad ocu da naucim i dialog :D
kako da ove komande napravim u dialogu
Dio skripte:


if (strcmp(cmd, "/svilideri", true) == 0)
{
        new text[32],sstring[32];
    new File:lider = fopen("Lideri/Lider.txt", io_read);
  while(fread(lider, text)) {
format(sstring,128,"%s",text);
        SendClientMessage(playerid,-1,sstring);}
    fclose(lider);
return 1;
    }



if (strcmp(cmd, "/onlinelideri", true) == 0)
{

    {
SendClientMessage(playerid, COLOR_RED, "|________ Online Lideri ________|");
for(new i = 0; i < MAX_PLAYERS; i++)
   {

    {
    if(PlayerInfo[i][pLeader] == 1)
    {
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "Policija [Lider %s] |Mob:", sendername);
SendClientMessage(playerid, COLOR_BLUE, string);
if(IsPlayerConnected(i))
SendClientMessage(playerid, COLOR_BLUE, "Online");
else
SendClientMessage(playerid, COLOR_BLUE, "Ofline");
}
                else if(PlayerInfo[i][pLeader] == 2)
    {
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "FBI [Lider %s] |Mob:", sendername);
SendClientMessage(playerid, COLOR_DBLUE, string);
if(IsPlayerConnected(i))
SendClientMessage(playerid, COLOR_BLUE, "Online");
else
SendClientMessage(playerid, COLOR_BLUE, "Ofline");
}
                else if(PlayerInfo[i][pLeader] == 3)
    {
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "Vojska [Lider %s] |Mob:", sendername);
SendClientMessage(playerid, COLOR_GREEN, string);
if(IsPlayerConnected(i))
SendClientMessage(playerid, COLOR_BLUE, "Online");
else
SendClientMessage(playerid, COLOR_BLUE, "Ofline");
}
                else if(PlayerInfo[i][pLeader] == 4)
    {
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "Hitna Pomoc [Lider %s] |Mob:", sendername);
SendClientMessage(playerid, COLOR_WHITE, string);
if(IsPlayerConnected(i))
SendClientMessage(playerid, COLOR_BLUE, "Online");
else
SendClientMessage(playerid, COLOR_BLUE, "Ofline");
}
        else if(PlayerInfo[i][pLeader] == 5)
    {
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "Crips [Lider %s] |Mob:", sendername);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
if(IsPlayerConnected(i))
SendClientMessage(playerid, COLOR_BLUE, "Online");
else
SendClientMessage(playerid, COLOR_BLUE, "Ofline");
}
        else if(PlayerInfo[i][pLeader] == 6)
    {
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "LCN [Lider %s] |Mob:", sendername);
SendClientMessage(playerid, COLOR_RED, string);
if(IsPlayerConnected(i))
SendClientMessage(playerid, COLOR_BLUE, "Online");
else
SendClientMessage(playerid, COLOR_BLUE, "Ofline");
}
                    else if(PlayerInfo[i][pLeader] == 7)
    {
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "Gradonacelnik [Lider %s] |Mob:", sendername);
SendClientMessage(playerid, COLOR_ORANGE, string);
if(IsPlayerConnected(i))
SendClientMessage(playerid, COLOR_BLUE, "Online");
else
SendClientMessage(playerid, COLOR_BLUE, "Ofline");
}
            else if(PlayerInfo[i][pLeader] == 8)
    {
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "Hitman [Lider %s] |Mob:", sendername);
SendClientMessage(playerid, COLOR_BLACK, string);
}
            else if(PlayerInfo[i][pLeader] == 9)
    {
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "RTS Studio [Lider %s] |Mob:", sendername);
SendClientMessage(playerid, COLOR_YELLOW, string);
if(IsPlayerConnected(i))
SendClientMessage(playerid, COLOR_BLUE, "Online");
else
SendClientMessage(playerid, COLOR_BLUE, "Ofline");
}
            else if(PlayerInfo[i][pLeader] == 10)
    {
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "Taxi [Lider %s] |Mob:", sendername);
SendClientMessage(playerid, COLOR_YELLOW, string);
if(IsPlayerConnected(i))
SendClientMessage(playerid, COLOR_BLUE, "Online");
else
SendClientMessage(playerid, COLOR_BLUE, "Ofline");
}
            else if(PlayerInfo[i][pLeader] == 11)
    {
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "Corleone [Lider %s] |Mob:", sendername);
SendClientMessage(playerid, COLOR_WHITE, string);
if(IsPlayerConnected(i))
SendClientMessage(playerid, COLOR_BLUE, "Online");
else
SendClientMessage(playerid, COLOR_BLUE, "Ofline");
}
            else if(PlayerInfo[i][pLeader] == 12)
    {
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "Hells Angels [Lider %s] |Mob:", sendername);
SendClientMessage(playerid, COLOR_GRAD2, string);
if(IsPlayerConnected(i))
SendClientMessage(playerid, COLOR_BLUE, "Online");
else
SendClientMessage(playerid, COLOR_BLUE, "Ofline");
}
            else if(PlayerInfo[i][pLeader] == 13)
    {
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "Ballas [Lider %s] |Mob:", sendername);
SendClientMessage(playerid, COLOR_PURPLE, string);
if(IsPlayerConnected(i))
SendClientMessage(playerid, COLOR_BLUE, "Online");
else
SendClientMessage(playerid, COLOR_BLUE, "Ofline");
}
            else if(PlayerInfo[i][pLeader] == 15)
    {
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "Grove Street [Lider %s] |Mob:", sendername);
SendClientMessage(playerid, COLOR_GREEN, string);
if(IsPlayerConnected(i))
SendClientMessage(playerid, COLOR_BLUE, "Online");
else
SendClientMessage(playerid, COLOR_BLUE, "Ofline");
}
}
}
}
return 1;
}



Marley

znaci ocu da kad kucam /svilideri da mi prikaze sve lidere iz fajla Lider.txt u dialogu, a ne kao text i ocu kad kucam /onlinelideri
da mi prikaze lidere u dialogu i pored da pise ono online i ofline a ne kao text
(ovo online i ofline da pise i nije toliko bitno ali ako znate napisite i za to  :) )
Poslednja Izmena: April 03, 2012, 20:57:43 POSLE PODNE od Marley

/svilideri:

if (strcmp(cmd, "/svilideri", true) == 0)
{
new
sLeaderName[25],
sTmpLeaderList[28],
sLeaderList[300],
File:leaderFile = fopen("Lideri/Lider.txt", io_read)
;

while(fread(leaderFile, sLeaderName)) {
format(sTmpLeaderList, sizeof(sTmpLeaderList), "%s\n", sLeaderName);
strcat(sLeaderList, sTmpLeaderList);
}

ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "SVI LIDERI", sLeaderList, "U redu", "");
fclose(lider);
return 1;
}


/onlinelideri:

if (strcmp(cmd, "/onlinelideri", true) == 0)
{
new
sTmpLeaderList[63],
sLeaderList[300]
;

for(new i = 0; i < GetMaxPlayers(); i++) {
if(PlayerInfo[i][pLeader] == 1)
{
GetPlayerName(i, sendername, sizeof(sendername));

if (IsPlayerConnected(i)) format(sTmpLeaderList, sizeof(sTmpLeaderList), "[ONLINE] Policija [Lider %s] |Mob:", sendername);
else format(sTmpLeaderList, sizeof(sTmpLeaderList), "[OFFLINE] Policija [Lider %s] |Mob:", sendername);

strcat(sLeaderList, sTmpLeaderList);
}
else if(PlayerInfo[i][pLeader] == 2)
{
GetPlayerName(i, sendername, sizeof(sendername));

if (IsPlayerConnected(i)) format(sTmpLeaderList, sizeof(sTmpLeaderList), "[ONLINE] FBI [Lider %s] |Mob:", sendername);
else format(sTmpLeaderList, sizeof(sTmpLeaderList), "[OFFLINE] FBI [Lider %s] |Mob:", sendername);

strcat(sLeaderList, sTmpLeaderList);
}
else if(PlayerInfo[i][pLeader] == 3)
{
GetPlayerName(i, sendername, sizeof(sendername));

if (IsPlayerConnected(i)) format(sTmpLeaderList, sizeof(sTmpLeaderList), "[ONLINE] Vojska [Lider %s] |Mob:", sendername);
else format(sTmpLeaderList, sizeof(sTmpLeaderList), "[OFFLINE] Vojska [Lider %s] |Mob:", sendername);

strcat(sLeaderList, sTmpLeaderList);
}
else if(PlayerInfo[i][pLeader] == 4)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "Hitna Pomoc [Lider %s] |Mob:", sendername);
SendClientMessage(playerid, COLOR_WHITE, string);
if(IsPlayerConnected(i))
SendClientMessage(playerid, COLOR_BLUE, "Online");
else
SendClientMessage(playerid, COLOR_BLUE, "Ofline");
}
else if(PlayerInfo[i][pLeader] == 5)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "Crips [Lider %s] |Mob:", sendername);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
if(IsPlayerConnected(i))
SendClientMessage(playerid, COLOR_BLUE, "Online");
else
SendClientMessage(playerid, COLOR_BLUE, "Ofline");
}
else if(PlayerInfo[i][pLeader] == 6)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "LCN [Lider %s] |Mob:", sendername);
SendClientMessage(playerid, COLOR_RED, string);
if(IsPlayerConnected(i))
SendClientMessage(playerid, COLOR_BLUE, "Online");
else
SendClientMessage(playerid, COLOR_BLUE, "Ofline");
}
else if(PlayerInfo[i][pLeader] == 7)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "Gradonacelnik [Lider %s] |Mob:", sendername);
SendClientMessage(playerid, COLOR_ORANGE, string);
if(IsPlayerConnected(i))
SendClientMessage(playerid, COLOR_BLUE, "Online");
else
SendClientMessage(playerid, COLOR_BLUE, "Ofline");
}
else if(PlayerInfo[i][pLeader] == 8)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "Hitman [Lider %s] |Mob:", sendername);
SendClientMessage(playerid, COLOR_BLACK, string);
}
else if(PlayerInfo[i][pLeader] == 9)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "RTS Studio [Lider %s] |Mob:", sendername);
SendClientMessage(playerid, COLOR_YELLOW, string);
if(IsPlayerConnected(i))
SendClientMessage(playerid, COLOR_BLUE, "Online");
else
SendClientMessage(playerid, COLOR_BLUE, "Ofline");
}
else if(PlayerInfo[i][pLeader] == 10)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "Taxi [Lider %s] |Mob:", sendername);
SendClientMessage(playerid, COLOR_YELLOW, string);
if(IsPlayerConnected(i))
SendClientMessage(playerid, COLOR_BLUE, "Online");
else
SendClientMessage(playerid, COLOR_BLUE, "Ofline");
}
else if(PlayerInfo[i][pLeader] == 11)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "Corleone [Lider %s] |Mob:", sendername);
SendClientMessage(playerid, COLOR_WHITE, string);
if(IsPlayerConnected(i))
SendClientMessage(playerid, COLOR_BLUE, "Online");
else
SendClientMessage(playerid, COLOR_BLUE, "Ofline");
}
else if(PlayerInfo[i][pLeader] == 12)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "Hells Angels [Lider %s] |Mob:", sendername);
SendClientMessage(playerid, COLOR_GRAD2, string);
if(IsPlayerConnected(i))
SendClientMessage(playerid, COLOR_BLUE, "Online");
else
SendClientMessage(playerid, COLOR_BLUE, "Ofline");
}
else if(PlayerInfo[i][pLeader] == 13)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "Ballas [Lider %s] |Mob:", sendername);
SendClientMessage(playerid, COLOR_PURPLE, string);
if(IsPlayerConnected(i))
SendClientMessage(playerid, COLOR_BLUE, "Online");
else
SendClientMessage(playerid, COLOR_BLUE, "Ofline");
}
else if(PlayerInfo[i][pLeader] == 15)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "Grove Street [Lider %s] |Mob:", sendername);
SendClientMessage(playerid, COLOR_GREEN, string);
if(IsPlayerConnected(i))
SendClientMessage(playerid, COLOR_BLUE, "Online");
else
SendClientMessage(playerid, COLOR_BLUE, "Ofline");
}
}

ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "ONLINE LIDERI", sLeaderList, "U redu", "");
return 1;
}


Za /onlinelideri komandu napravi ove ostale sam po mojim prvim trima primjerima - možeš samo c/p i mijenjaš imena organizacija.

I jedna napomena: komande nisu testirane, ali trebale bi raditi.

Last nick: Paradox

Marley

Citat: Joey_ poslato April 03, 2012, 22:34:52 POSLE PODNE
/svilideri:

if (strcmp(cmd, "/svilideri", true) == 0)
{
new
sLeaderName[25],
sTmpLeaderList[28],
sLeaderList[300],
File:leaderFile = fopen("Lideri/Lider.txt", io_read)
;

while(fread(leaderFile, sLeaderName)) {
format(sTmpLeaderList, sizeof(sTmpLeaderList), "%s\n", sLeaderName);
strcat(sLeaderList, sTmpLeaderList);
}

ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "SVI LIDERI", sLeaderList, "U redu", "");
fclose(lider);
return 1;
}


/onlinelideri:

if (strcmp(cmd, "/onlinelideri", true) == 0)
{
new
sTmpLeaderList[63],
sLeaderList[300]
;

for(new i = 0; i < GetMaxPlayers(); i++) {
if(PlayerInfo[i][pLeader] == 1)
{
GetPlayerName(i, sendername, sizeof(sendername));

if (IsPlayerConnected(i)) format(sTmpLeaderList, sizeof(sTmpLeaderList), "[ONLINE] Policija [Lider %s] |Mob:", sendername);
else format(sTmpLeaderList, sizeof(sTmpLeaderList), "[OFFLINE] Policija [Lider %s] |Mob:", sendername);

strcat(sLeaderList, sTmpLeaderList);
}
else if(PlayerInfo[i][pLeader] == 2)
{
GetPlayerName(i, sendername, sizeof(sendername));

if (IsPlayerConnected(i)) format(sTmpLeaderList, sizeof(sTmpLeaderList), "[ONLINE] FBI [Lider %s] |Mob:", sendername);
else format(sTmpLeaderList, sizeof(sTmpLeaderList), "[OFFLINE] FBI [Lider %s] |Mob:", sendername);

strcat(sLeaderList, sTmpLeaderList);
}
else if(PlayerInfo[i][pLeader] == 3)
{
GetPlayerName(i, sendername, sizeof(sendername));

if (IsPlayerConnected(i)) format(sTmpLeaderList, sizeof(sTmpLeaderList), "[ONLINE] Vojska [Lider %s] |Mob:", sendername);
else format(sTmpLeaderList, sizeof(sTmpLeaderList), "[OFFLINE] Vojska [Lider %s] |Mob:", sendername);

strcat(sLeaderList, sTmpLeaderList);
}
else if(PlayerInfo[i][pLeader] == 4)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "Hitna Pomoc [Lider %s] |Mob:", sendername);
SendClientMessage(playerid, COLOR_WHITE, string);
if(IsPlayerConnected(i))
SendClientMessage(playerid, COLOR_BLUE, "Online");
else
SendClientMessage(playerid, COLOR_BLUE, "Ofline");
}
else if(PlayerInfo[i][pLeader] == 5)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "Crips [Lider %s] |Mob:", sendername);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
if(IsPlayerConnected(i))
SendClientMessage(playerid, COLOR_BLUE, "Online");
else
SendClientMessage(playerid, COLOR_BLUE, "Ofline");
}
else if(PlayerInfo[i][pLeader] == 6)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "LCN [Lider %s] |Mob:", sendername);
SendClientMessage(playerid, COLOR_RED, string);
if(IsPlayerConnected(i))
SendClientMessage(playerid, COLOR_BLUE, "Online");
else
SendClientMessage(playerid, COLOR_BLUE, "Ofline");
}
else if(PlayerInfo[i][pLeader] == 7)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "Gradonacelnik [Lider %s] |Mob:", sendername);
SendClientMessage(playerid, COLOR_ORANGE, string);
if(IsPlayerConnected(i))
SendClientMessage(playerid, COLOR_BLUE, "Online");
else
SendClientMessage(playerid, COLOR_BLUE, "Ofline");
}
else if(PlayerInfo[i][pLeader] == 8)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "Hitman [Lider %s] |Mob:", sendername);
SendClientMessage(playerid, COLOR_BLACK, string);
}
else if(PlayerInfo[i][pLeader] == 9)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "RTS Studio [Lider %s] |Mob:", sendername);
SendClientMessage(playerid, COLOR_YELLOW, string);
if(IsPlayerConnected(i))
SendClientMessage(playerid, COLOR_BLUE, "Online");
else
SendClientMessage(playerid, COLOR_BLUE, "Ofline");
}
else if(PlayerInfo[i][pLeader] == 10)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "Taxi [Lider %s] |Mob:", sendername);
SendClientMessage(playerid, COLOR_YELLOW, string);
if(IsPlayerConnected(i))
SendClientMessage(playerid, COLOR_BLUE, "Online");
else
SendClientMessage(playerid, COLOR_BLUE, "Ofline");
}
else if(PlayerInfo[i][pLeader] == 11)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "Corleone [Lider %s] |Mob:", sendername);
SendClientMessage(playerid, COLOR_WHITE, string);
if(IsPlayerConnected(i))
SendClientMessage(playerid, COLOR_BLUE, "Online");
else
SendClientMessage(playerid, COLOR_BLUE, "Ofline");
}
else if(PlayerInfo[i][pLeader] == 12)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "Hells Angels [Lider %s] |Mob:", sendername);
SendClientMessage(playerid, COLOR_GRAD2, string);
if(IsPlayerConnected(i))
SendClientMessage(playerid, COLOR_BLUE, "Online");
else
SendClientMessage(playerid, COLOR_BLUE, "Ofline");
}
else if(PlayerInfo[i][pLeader] == 13)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "Ballas [Lider %s] |Mob:", sendername);
SendClientMessage(playerid, COLOR_PURPLE, string);
if(IsPlayerConnected(i))
SendClientMessage(playerid, COLOR_BLUE, "Online");
else
SendClientMessage(playerid, COLOR_BLUE, "Ofline");
}
else if(PlayerInfo[i][pLeader] == 15)
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, 256, "Grove Street [Lider %s] |Mob:", sendername);
SendClientMessage(playerid, COLOR_GREEN, string);
if(IsPlayerConnected(i))
SendClientMessage(playerid, COLOR_BLUE, "Online");
else
SendClientMessage(playerid, COLOR_BLUE, "Ofline");
}
}

ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "ONLINE LIDERI", sLeaderList, "U redu", "");
return 1;
}


Za /onlinelideri komandu napravi ove ostale sam po mojim prvim trima primjerima - možeš samo c/p i mijenjaš imena organizacija.

I jedna napomena: komande nisu testirane, ali trebale bi raditi.
tnx, radi  ;)

Marley

mozete lock temu skonto sam  8)

Problem je riješen - LOCK

Last nick: Paradox