Jump to content
  • 0

Sa-mp


DavidTKD

Question

Salut am o problema la sistemul de war mai exact am intervalul de ore la war-uri este 20-23 bun problema este alta pot sa dau decat un war si dupa imi spune ca war-urile se pot da doar in interalul 20-23 se poate modifica de undeva cate war-uri sa fie pe zi sau ceva de genul ?

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

Asta este comanda

 

CMD:attack(playerid, params[]) {
    if(!IsAMember(playerid)) return SendClientMessage(playerid,COLOR_GREY, "Nu faci parte dintr-o mafie.");
    if(PlayerInfo[playerid][pRank] < 3) return SendClientMessage(playerid,COLOR_LIGHTBLUE,"You do not have rank 3.");
    new turf,string[100];
    for(new i = 1; i <= sizeof(TurfInfo); i++) {
        if(IsPlayerInTurf(playerid, i) == 1) {
            turf = i;
            break;
        }
    }
    new hour,minute,second, year, month, day;
    gettime(hour,minute,second);
    getdate(year, month, day);
    new days[180];
    format(days, sizeof(days), GetWeekDay(day, month, year));
    if(PlayerInfo[playerid][pAdmin] < 7) {
        if(strcmp(days,"Saturday",true) == 0 || strcmp(days,"Sunday",true) == 0) return SCM(playerid, COLOR_LIGHTRED, "Nu se dau war-uri in weekend!");    
        if(hour == 20 || hour == 23) {}
        else return SendClientMessage(playerid, COLOR_LIGHTRED, "War-uri se pot da doar in intervalul 20:00 - 23:00!");
        if(GetFactionMembersOn2(PlayerInfo[playerid][pMember]) < 1) return SCM(playerid, COLOR_LGREEN, "Nu poti folosi aceasta comanda deoarece nu sunt minim 3 membri conectati din factiunea ta!");
        if(GetFactionMembersOn2(TurfInfo[turf][zOwned]) < 1) return SCM(playerid, COLOR_LGREEN, "Nu poti folosi aceasta comanda deoarece nu sunt minim 3 membri conectati din factiunea care detine teritoriul!");
    }    
    if(turf == 0) return SendClientMessage(playerid, COLOR_WHITE, "Nu esti pe un teritoriu!");
    new faction = PlayerInfo[playerid][pMember];
    if(TurfInfo[turf][zOwned] == faction) return SendClientMessage(playerid, COLOR_GREY, "Nu poti ataca turful mafiei tale.");
    if(WarInfo[turf][wAttacker] != 0) return SendClientMessage(playerid, COLOR_WHITE, "Acest turf este deja atacat.");
    if(InWar[faction] == 1) return SendClientMessage(playerid, COLOR_WHITE, "Este deja un war activ.");
    if(InWar[TurfInfo[turf][zOwned]] == 1) return SendClientMessage(playerid, COLOR_WHITE, "Aceasta mafie are deja un war activ.");
    if(FactionDeelay[PlayerInfo[playerid][pMember]] != 0) {
        format(string, sizeof(string), "Poti folosi aceasta comanda peste %d minute (%d secunde).", FactionDeelay[PlayerInfo[playerid][pMember]]/60, FactionDeelay[PlayerInfo[playerid][pMember]]);
        SCM(playerid, COLOR_LGREEN, string);
        return 1;
    }
    format(string, sizeof(string), "[WAR] %s started a war with %s.",FactionName(WarInfo[turf][wAttacker]), FactionName(TurfInfo[turf][zOwned]));
    SendAdminMessage(COLOR_LOGS, string, 1);
    format(string, sizeof(string), "[WAR] %s a atacat teritoriul %d detinut de factiunea %s.",GetName(playerid),turf,FactionName(TurfInfo[turf][zOwned]));
    SendFactionMessage(faction,COLOR_MONEY,string);
    format(string, sizeof(string), "[WAR] %s (%s) a atacat teritoriul %d detinut de factiunea ta.",FactionName(WarInfo[turf][wAttacker]),GetName(playerid),turf);
    SendFactionMessage(TurfInfo[turf][zOwned],COLOR_MONEY,string);
    new query[128];
    format(query,sizeof(query),"UPDATE `turfs` SET `Time`='24' WHERE `ID`='%d'",turf);
    mysql_query(SQL,query);
    
    TurfInfo[turf][zTime] = 24;
    if(PlayerInfo[playerid][pAdmin] == 7) WarInfo[turf][wTime] = 120;
    else WarInfo[turf][wTime] = 1200;
    WarInfo[turf][wAttacker] = faction;
    WarInfo[turf][wFaction] = TurfInfo[turf][zOwned];
    worstscoreat[turf] = 0;
    worstmemberat[turf] = 999;
    bestscoreat[turf] = 0;
    bestmemberat[turf] = 999;
    worstscoredf[turf] = 0;
    worstmemberdf[turf] = 999;
    bestscoredf[turf] = 0;
    bestmemberdf[turf] = 999;
    InWar[TurfInfo[turf][zOwned]] = 1;
    InWar[faction] = 1;
    
    InWarTurf[faction] = turf;
    InWarTurf[TurfInfo[turf][zOwned]] = turf;
    
    foreach(Player, i) {
        if(IsPlayerLogged == 1) {
            if(PlayerInfo[pMember] == faction || PlayerInfo[pMember] == TurfInfo[turf][zOwned]) UpdateVar(i, "WarTurf", turf);
        }
    }
    
    SetVehicle(faction, turf);
    SetVehicle(TurfInfo[turf][zOwned], turf);
    return 1;
}

function SetVehicle(fid, turf) {
    for(new i; i < MAX_SVEHICLES; i++) {
        if(ServerVehicles[vFaction] == fid) SetVehicleVirtualWorld(i, turf);
    }                    
    return 1;
} 

 

Link to comment
Share on other sites

  • 0
Acum 16 ore, DavidTKD a spus:

Asta este comanda

 


CMD:attack(playerid, params[]) {
    if(!IsAMember(playerid)) return SendClientMessage(playerid,COLOR_GREY, "Nu faci parte dintr-o mafie.");
    if(PlayerInfo[playerid][pRank] < 3) return SendClientMessage(playerid,COLOR_LIGHTBLUE,"You do not have rank 3.");
    new turf,string[100];
    for(new i = 1; i <= sizeof(TurfInfo); i++) {
        if(IsPlayerInTurf(playerid, i) == 1) {
            turf = i;
            break;
        }
    }
    new hour,minute,second, year, month, day;
    gettime(hour,minute,second);
    getdate(year, month, day);
    new days[180];
    format(days, sizeof(days), GetWeekDay(day, month, year));
    if(PlayerInfo[playerid][pAdmin] < 7) {
        if(strcmp(days,"Saturday",true) == 0 || strcmp(days,"Sunday",true) == 0) return SCM(playerid, COLOR_LIGHTRED, "Nu se dau war-uri in weekend!");    
        if(hour == 20 || hour == 23) {}
        else return SendClientMessage(playerid, COLOR_LIGHTRED, "War-uri se pot da doar in intervalul 20:00 - 23:00!");
        if(GetFactionMembersOn2(PlayerInfo[playerid][pMember]) < 1) return SCM(playerid, COLOR_LGREEN, "Nu poti folosi aceasta comanda deoarece nu sunt minim 3 membri conectati din factiunea ta!");
        if(GetFactionMembersOn2(TurfInfo[turf][zOwned]) < 1) return SCM(playerid, COLOR_LGREEN, "Nu poti folosi aceasta comanda deoarece nu sunt minim 3 membri conectati din factiunea care detine teritoriul!");
    }    
    if(turf == 0) return SendClientMessage(playerid, COLOR_WHITE, "Nu esti pe un teritoriu!");
    new faction = PlayerInfo[playerid][pMember];
    if(TurfInfo[turf][zOwned] == faction) return SendClientMessage(playerid, COLOR_GREY, "Nu poti ataca turful mafiei tale.");
    if(WarInfo[turf][wAttacker] != 0) return SendClientMessage(playerid, COLOR_WHITE, "Acest turf este deja atacat.");
    if(InWar[faction] == 1) return SendClientMessage(playerid, COLOR_WHITE, "Este deja un war activ.");
    if(InWar[TurfInfo[turf][zOwned]] == 1) return SendClientMessage(playerid, COLOR_WHITE, "Aceasta mafie are deja un war activ.");
    if(FactionDeelay[PlayerInfo[playerid][pMember]] != 0) {
        format(string, sizeof(string), "Poti folosi aceasta comanda peste %d minute (%d secunde).", FactionDeelay[PlayerInfo[playerid][pMember]]/60, FactionDeelay[PlayerInfo[playerid][pMember]]);
        SCM(playerid, COLOR_LGREEN, string);
        return 1;
    }
    format(string, sizeof(string), "[WAR] %s started a war with %s.",FactionName(WarInfo[turf][wAttacker]), FactionName(TurfInfo[turf][zOwned]));
    SendAdminMessage(COLOR_LOGS, string, 1);
    format(string, sizeof(string), "[WAR] %s a atacat teritoriul %d detinut de factiunea %s.",GetName(playerid),turf,FactionName(TurfInfo[turf][zOwned]));
    SendFactionMessage(faction,COLOR_MONEY,string);
    format(string, sizeof(string), "[WAR] %s (%s) a atacat teritoriul %d detinut de factiunea ta.",FactionName(WarInfo[turf][wAttacker]),GetName(playerid),turf);
    SendFactionMessage(TurfInfo[turf][zOwned],COLOR_MONEY,string);
    new query[128];
    format(query,sizeof(query),"UPDATE `turfs` SET `Time`='24' WHERE `ID`='%d'",turf);
    mysql_query(SQL,query);
    
    TurfInfo[turf][zTime] = 24;
    if(PlayerInfo[playerid][pAdmin] == 7) WarInfo[turf][wTime] = 120;
    else WarInfo[turf][wTime] = 1200;
    WarInfo[turf][wAttacker] = faction;
    WarInfo[turf][wFaction] = TurfInfo[turf][zOwned];
    worstscoreat[turf] = 0;
    worstmemberat[turf] = 999;
    bestscoreat[turf] = 0;
    bestmemberat[turf] = 999;
    worstscoredf[turf] = 0;
    worstmemberdf[turf] = 999;
    bestscoredf[turf] = 0;
    bestmemberdf[turf] = 999;
    InWar[TurfInfo[turf][zOwned]] = 1;
    InWar[faction] = 1;
    
    InWarTurf[faction] = turf;
    InWarTurf[TurfInfo[turf][zOwned]] = turf;
    
    foreach(Player, i) {
        if(IsPlayerLogged == 1) {
            if(PlayerInfo[pMember] == faction || PlayerInfo[pMember] == TurfInfo[turf][zOwned]) UpdateVar(i, "WarTurf", turf);
        }
    }
    
    SetVehicle(faction, turf);
    SetVehicle(TurfInfo[turf][zOwned], turf);
    return 1;
}

function SetVehicle(fid, turf) {
    for(new i; i < MAX_SVEHICLES; i++) {
        if(ServerVehicles[vFaction] == fid) SetVehicleVirtualWorld(i, turf);
    }                    
    return 1;
} 

 

if(hour >= 20 && hour <= 23) 

in loc de 

if(hour == 20 || hour == 23)
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.