Making Command only used in specific time interval. [+REP]
#3

PHP код:
CMD:attack(playeridparams[]) 

    if(
gPlayerLogged[playerid] == 0) return SendClientMessage(playeridCOLOR_LIGHTRED"You need to login first."); 
    new 
hour,minn,sec
    
gettime(hour,minn,sec);
    if(
hour<20 || hour>22) return SendClientMessage(playerid, -1"You cannot attack now.");
    if(!
IsAMember(playerid)) return SCM(playerid,COLOR_WHITE,"{FFB870}Error: You are not a member of the Mafia."); 
    if(
PlayerInfo[playerid][pRank] < 3) return SCM(playerid,TEAM_AZTECAS_COLOR,"Error: You do not have rank 3."); 
    new 
turf,faction,string[100],sendername[MAX_PLAYER_NAME]; 
    for(new 
1<= sizeof(TurfInfo); i++) 
    { 
        if(
IsPlayerInTurf(playeridi) == 1
        { 
            
turf i
            break; 
        } 
    } 
    
GetPlayerName(playeridsendernamesizeof(sendername)); 
    if(
turf == 0) return SCM(playeridTEAM_AZTECAS_COLOR"Error: You are not on a territory."); 
    
faction PlayerInfo[playerid][pMember]; 
    if(
TurfInfo[turf][zOwned] == faction) return SCM(playeridTEAM_AZTECAS_COLOR"Error: You can't attack your own turf."); 
    if(
WarInfo[turf][wAttacker] != 0) return SCM(playeridTEAM_AZTECAS_COLOR"Error: Turf is already attacked."); 
    if(
TurfInfo[turf][zTime] > 0
    { 
        
format(string,sizeof(string),"Error: Turf can be attacked in %d hours.",TurfInfo[turf][zTime]); 
        
SCM(playeridTEAM_AZTECAS_COLOR,string); 
        return 
1
    } 
    if(
InWar[faction] == 1) return SCM(playeridTEAM_AZTECAS_COLOR"Error: You have an active war."); 
    if(
InWar[TurfInfo[turf][zOwned]] == 1) return SCM(playeridTEAM_AZTECAS_COLOR"Error: This mafia have active war."); 
    
TurfInfo[turf][zTime] = 24
    new 
str[128]; 
    
format(str,128,"UPDATE `turfs` SET `Time`='24' WHERE `ID`='%d'",turf); 
    
mysql_query(SQL,str); 
    
WarInfo[turf][wTime] = 900
    
WarInfo[turf][wAttacker] = faction
    
WarInfo[turf][wFaction] = TurfInfo[turf][zOwned]; 
    
format(string,sizeof(string),"Your mafia (%s) attacked turf %d owned by %s",sendername,turf,NumeFactiune(TurfInfo[turf][zOwned])); 
    
SendFamilyMessage(faction,TEAM_AZTECAS_COLOR,string); 
    
format(string,sizeof(string),"Turf %d, Time remaining: %s",turf,CalculeazaTimp(WarInfo[turf][wTime])); 
    
SendFamilyMessage(faction,TEAM_AZTECAS_COLOR,string); 
    
format(string,sizeof(string),"%s (%s) attacked your turf %d",NumeFactiune(WarInfo[turf][wAttacker]),sendername,turf); 
    
SendFamilyMessage(TurfInfo[turf][zOwned],TEAM_AZTECAS_COLOR,string); 
    
format(string,sizeof(string),"Turf %d, Time remaining: %s",turf,CalculeazaTimp(WarInfo[turf][wTime])); 
    
SendFamilyMessage(TurfInfo[turf][zOwned],TEAM_AZTECAS_COLOR,string); 
    
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
    return 
1

Reply


Messages In This Thread
Making Command only used in specific time interval. [+REP] - by EgyptForLife - 30.12.2015, 11:42
Re: Making Command only used in specific time interval. [+REP] - by F1N4L - 30.12.2015, 11:56
Re: Making Command only used in specific time interval. [+REP] - by ATGOggy - 30.12.2015, 12:04
Re: Making Command only used in specific time interval. [+REP] - by Amunra - 30.12.2015, 12:12
Re: Making Command only used in specific time interval. [+REP] - by ATGOggy - 30.12.2015, 13:07

Forum Jump:


Users browsing this thread: 1 Guest(s)