[POMOC] leaders

Započeo Marley, April 01, 2012, 17:01:10 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 2 gostiju pregledaju ovu temu.

Marley


new OrgText[10];
            if(level == 1) OrgText = "Policija"
            else if(level == 2) OrgText = "FBI"
            else if(level == 3) OrgText = "Vojska"
            else if(level == 4) OrgText = "Hitna"
            else if(level == 5) OrgText = "Crips"
            else if(level == 6) OrgText = "LCN"
            else if(level == 7) OrgText = "Mayor"
            else if(level == 8) OrgText = "Hitman"
            else if(level == 9) OrgText = "Novinari"
            else if(level == 10) OrgText = "Taxi"
            else if(level == 11) OrgText = "Corleone"
            else if(level == 12) OrgText = "Hells"
            else if(level == 13) OrgText = "Ballas"
            else if(level == 14) OrgText = "Seljaci"
                            else if(level == 15) OrgText = "Groove"
                            else if(level == 16) OrgText = "Vagos"
                            new text[256];
                            new File:log = fopen("Lideri/Lider.txt", io_write); // Open the file
                            format(text,64,"%s: %s\r\n",OrgText,GetName(para1));
                            fwrite(log, text); // Write to the file (\r\n is for a new line)
                            fclose(log); // Close the file

ocul promenit ovo OrgText[10];
i ocul promenit ovo text,64 u ovom delu


format(text,64,"%s: %s\r\n",OrgText,GetName(para1));

Marley

eo vam sve u vezi ovog problema mozda ce te mi lakse pomoc


if(strcmp(cmd, "/makeleader", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "Koristite: /makeleader [playerid/PartOfName] [Number(1-15)]");
return 1;
}
new para1;
new level;
para1 = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
level = strval(tmp);
if(level > 16 || level < 0) { SendClientMessage(playerid, COLOR_GREY, "   Ne idite ispod 0, ili iznad 16!"); return 1; }
if (PlayerInfo[playerid][pAdmin] >= 4)
{
    if(IsPlayerConnected(para1))
    {
        if(para1 != INVALID_PLAYER_ID)
        {
            if(PlayerInfo[para1][pMember] > 0 || PlayerInfo[para1][pFMember] < 255)
            {
                SendClientMessage(playerid, COLOR_GREY, "   Taj igrac je u Faction / Family !");
                return 1;
            }
GetPlayerName(para1, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
PlayerInfo[para1][pLeader] = level;
format(string, sizeof(string), "   Vi ste postavljeni za lidera od Administratora %s", sendername);
SendClientMessage(para1, COLOR_WHITE, string);
format(string, sizeof(string), "   Vi ste dali %s broj organizacije %d.", giveplayer,level);
SendClientMessage(playerid, COLOR_WHITE, string);
                        if(level == 0) { PlayerInfo[para1][pChar] = 0; PlayerInfo[para1][pRank] = 0; gTeam[para1] = 3; PlayerInfo[para1][pTeam] = 0; return 1; }
else if(level == 1) { PlayerInfo[para1][pChar] = 288; } //Police Force
else if(level == 2) { PlayerInfo[para1][pChar] = 286; } //FBI/ATF
else if(level == 3) { PlayerInfo[para1][pChar] = 287; } //National Guard
else if(level == 4) { PlayerInfo[para1][pChar] = 228; } //Fire/Ambulance
else if(level == 5) { PlayerInfo[para1][pChar] = 115; } //Crips
else if(level == 6) { PlayerInfo[para1][pChar] = 113; } //La Cosa Nostra
else if(level == 7) { PlayerInfo[para1][pChar] = 147; } //Mayor
else if(level == 8) { PlayerInfo[para1][pChar] = 294; } //Hitmans
else if(level == 9) { PlayerInfo[para1][pChar] = 227; } //RTS Studio
else if(level == 10) { PlayerInfo[para1][pChar] = 61; } //Taxi Cab Company
else if(level == 11) { PlayerInfo[para1][pChar] = 121; } //Corleone
else if(level == 12) { PlayerInfo[para1][pChar] = 248; } //Hells Angels
else if(level == 13) { PlayerInfo[para1][pChar] = 104; } //Ballas
else if(level == 15) { PlayerInfo[para1][pChar] = 271; } //GroveStreet Families
else if(level == 16) { PlayerInfo[para1][pChar] = 110; } // Los Antos Vagos

if(level == 0)
{
    gTeam[para1] = 3;
    PlayerInfo[para1][pTeam] = 3;
}
else if(level == 1 || level == 2 || level == 3)
{
    gTeam[para1] = 2;
    PlayerInfo[para1][pTeam] = 2;
}
else if(level == 4)
{
    gTeam[para1] = 1;
    PlayerInfo[para1][pTeam] = 1;
}
else
{
    gTeam[para1] = 15;
    PlayerInfo[para1][pTeam] = 15;
}

    SetPlayerSkin(para1, PlayerInfo[para1][pChar]);

    if(level == 0)
    {
        PlayerInfo[para1][pRank] = 0;
    }
    else
    {
    PlayerInfo[para1][pRank] = 6;
      }
                            new OrgText[512];
            if(level == 1) OrgText = "Policija"
            else if(level == 2) OrgText = "FBI"
            else if(level == 3) OrgText = "Vojska"
            else if(level == 4) OrgText = "Hitna"
            else if(level == 5) OrgText = "Crips"
            else if(level == 6) OrgText = "LCN"
            else if(level == 7) OrgText = "Mayor"
            else if(level == 8) OrgText = "Hitman"
            else if(level == 9) OrgText = "Novinari"
            else if(level == 10) OrgText = "Taxi"
            else if(level == 11) OrgText = "Corleone"
            else if(level == 12) OrgText = "Hells"
            else if(level == 13) OrgText = "Ballas"
            else if(level == 14) OrgText = "Seljaci"
                            else if(level == 15) OrgText = "Groove"
                            else if(level == 16) OrgText = "Vagos"
                            new text[512];
                            new File:log = fopen("Lideri/Lider.txt", io_write); // Open the file
                            format(text,512,"%s: %s\r\n",OrgText,GetName(para1));
                            fwrite(log, text); // Write to the file (\r\n is for a new line)
fclose(log); // Close the file
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "   Niste autorizovani da bi ste Koristiteli ovu komandu!");
}
}
return 1;
}



if (strcmp(cmd, "/svilideri", true) == 0)
{
        SendClientMessage(playerid, COLOR_RED, "|________ Regicide RolePlay Lideri ________|");
        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;
}



stock GetName(playerid)
{
    new
        pName[MAX_PLAYER_NAME];

    GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
    return pName;
}
Poslednja Izmena: April 03, 2012, 14:05:58 POSLE PODNE od Marley

Marley

jer moze neko brzo pomoc hitno mi ovo treba  :)
Poslednja Izmena: April 03, 2012, 16:10:40 POSLE PODNE od Marley

io_write ce ti obrisati file i krairati isti iako postoji...

tebi treba io_append - on ce kreirati file ako ne postoji, a ako postoji stavit ce pointer na kraj filea i nastaviti pisati od tamo...

Marley

Citat: Dude poslato April 03, 2012, 17:03:19 POSLE PODNE
io_write ce ti obrisati file i krairati isti iako postoji...

tebi treba io_append - on ce kreirati file ako ne postoji, a ako postoji stavit ce pointer na kraj filea i nastaviti pisati od tamo...
hvala mozete lock temu
Poslednja Izmena: April 03, 2012, 19:19:28 POSLE PODNE od Marley