Jump to content
  • 0

Problema /attack


Rayan

Question

Cand jucatorul nu este pe un turf spune ca Comanda nu exista, insa in comanda e pusa ca daca jucatorul nu se afla pe niciun turf sa ii zica "You are not on a turf". insa inloc sa scrie asta, scrie ca SERVER: Unknown Command.

 

Cine stie cum sa rezolv poate posta aici, multumesc!

 

CMD:attack(playerid, params[])
{
	if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to log in first.");
	new hour,minn,sec,y,m,d;
	gettime(hour,minn,sec);
	getdate(y,m,d);
	if(IsPlayerConnected(playerid))
	{
		if(!IsAMember(playerid)) return SCM(playerid,COLOR_WHITE,"You are not a member of a mafia.");
		if(PlayerInfo[playerid][pRank] < 4) return SCM(playerid,COLOR_WHITE,"You don't have rank 4.");
		if(m == 12 && d == 25 || m == 12 && d == 26) return SS(playerid, COLOR_WHITE, "Nu poti folosi aceasta comanda pe 25 sau 26 decembrie.", "You can't use this command on 25 or 26 december.");
		if(m == 1 && d == 1 || m == 1 && d == 2) return SS(playerid, COLOR_WHITE, "Nu poti folosi aceasta comanda pe 1 sau pe 2 ianuarie.", "You can't use this command on 1 or 2 January.");
		//if(GetWeekDay() == 1 || GetWeekDay() == 4 || GetWeekDay() == 6) return SS(playerid, COLOR_WHITE, "War-ul este permis doar Luni, Miercuri, Vineri si Duminica.", "You can use this command only Monday, Wednesday, Friday and Sunday.");
		if(hour == 20 || hour == 21 || hour == 22 || hour == 23 || hour == 24)
		{
			new turf,faction,string[128],sendername[MAX_PLAYER_NAME];
			for(new i = 1; i <= sizeof(TurfInfo); i++)
			{
				if(IsPlayerInTurf(playerid, i) == 1)
				{
					turf = i;
					break;
				}
    		}
    		GetPlayerName(playerid, sendername, sizeof(sendername));
    		if(turf == 0) return SCM(playerid, COLOR_WHITE, "You are not on a turf.");
			if(DeelayWar[PlayerInfo[playerid][pMember]] > 0)
			{
				format(string,sizeof(string),"(War) {FFFFFF}Your mafia can attack another turf in %d seconds.",DeelayWar[PlayerInfo[playerid][pMember]]);
				SendClientMessage(playerid, COLOR_GREEN, string);
				return 1;
			}
    		faction = PlayerInfo[playerid][pMember];
    		if(TurfInfo[turf][zOwned] == faction) return SCM(playerid, COLOR_WHITE, "You can't attack your own turf.");
			if(WarInfo[turf][wAttacker] != 0) return SCM(playerid, COLOR_WHITE, "Turf is already attacked.");
			if(InWar[faction] == 1) return SCM(playerid, COLOR_WHITE, "You have an active war.");
			if(InWar[TurfInfo[turf][zOwned]] == 1) return SCM(playerid, COLOR_WHITE, "This mafia have active war.");
			new memberss;
			foreach(new i : Player)
			{
	    		if(IsPlayerConnected(i))
	    		{
	        		if(PlayerInfo[i][pMember] == TurfInfo[turf][zOwned])
					{
			    		memberss ++;
					}
				}
			}
			if(memberss < 1) return SCM(playerid, COLOR_WHITE, "This mafia don't have members online.");
			WarInfo[turf][wTime] = 1200;
			WarInfo[turf][wAttacker] = faction;
			WarInfo[turf][wFaction] = TurfInfo[turf][zOwned];
			format(string,sizeof(string),"[TURF] %s from your group attacked turf %d (owned by %s).",sendername,turf,NumeFactiune(TurfInfo[turf][zOwned]));
			SendFamilyMessage(faction,COLOR_GREEN,string);
			format(string,sizeof(string),"[TURF] %s from %s attacked turf %d owned by you.",sendername,NumeFactiune(WarInfo[turf][wAttacker]),turf);
			SendFamilyMessage(TurfInfo[turf][zOwned],COLOR_GREEN,string);
			new Cache: abs = mysql_query(SQL, "SELECT * FROM wars");
			new warid = cache_get_row_count() + 1;
			cache_delete(abs);
			format(string, sizeof(string),"[WAR] %s started a war with %s (war id: %d).",NumeFactiune(WarInfo[turf][wAttacker]),NumeFactiune(TurfInfo[turf][zOwned]),warid);
			ABroadCast(COLOR_ADMCOMMANDS,string,1);
			foreach(new i : Player)
			{
				if(PlayerInfo[i][pMember] == TurfInfo[turf][zOwned] || PlayerInfo[i][pMember] == WarInfo[turf][wAttacker])
				{
					SetPlayerVirtualWorld(i, 1024);
					SS(i, COLOR_YELLOW, "Ai fost teleportat intr-un Virtual World unde sunt prezenti doar jucatorii ce participa la war.", "You have been teleported to a virtual world where only players participating in the war are present.");
				}
			}
			if(WarInfo[turf][wAttacker] == 4 || TurfInfo[turf][zOwned] == 4)
			{
				for(new x = 0; x < sizeof(VehicleInfo); x++)
				{
					if(VehicleInfo[x][vehGroup] == 4)
					{
						SetVehicleVirtualWorld(VehicleInfo[x][vehCarID], 1024);
					}
				}
			}
			if(WarInfo[turf][wAttacker] == 5 || TurfInfo[turf][zOwned] == 5)
			{
				for(new x = 0; x < sizeof(VehicleInfo); x++)
				{
					if(VehicleInfo[x][vehGroup] == 5)
					{
						SetVehicleVirtualWorld(VehicleInfo[x][vehCarID], 1024);
					}
				}
			}
			if(WarInfo[turf][wAttacker] == 6 || TurfInfo[turf][zOwned] == 6)
			{
				for(new x = 0; x < sizeof(VehicleInfo); x++)
				{
					if(VehicleInfo[x][vehGroup] == 6)
					{
						SetVehicleVirtualWorld(VehicleInfo[x][vehCarID], 1024);
					}
				}
			}
			if(WarInfo[turf][wAttacker] == 10 || TurfInfo[turf][zOwned] == 10)
			{
				for(new x = 0; x < sizeof(VehicleInfo); x++)
				{
					if(VehicleInfo[x][vehGroup] == 10)
					{
						SetVehicleVirtualWorld(VehicleInfo[x][vehCarID], 1024);
					}
				}
			}
			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;
			waitwar[faction] = 60;
		}
		else return SS(playerid, COLOR_LIGHTGREEN3, "Poti folosi aceasta comanda doar intre orele 20:00 - 22:00.", "War must be between 20:00 and 22:00.");
	}
	return 1;
}

 

Edited by Rayan
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

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.

×
×
  • 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.