we cant use this easy idea ?
#1

guys we cant use this idea ?

means

if there is any cmd for gwar // gwar- minigame


Код:
COMMAND:gwar(playerid, params[])
{
	if(Player[playerid][PlayerGang] != -1)
	{
		if(Gang[Player[playerid][PlayerGang]][CurrentZone] == -1)
		{
			new bool:found = false, i, total = 0, area = Area_GetPlayerAreas(playerid, 0);
			foreach(i : GangZones)
			{
				if(area == GangZone[i][ZoneArea])
				{
					found = true;
					break;
				}
			}
			if(found)
			{
				if(!GangZone[i][ZoneStatus])
				{
					if(GangZone[i][ZoneOwner] != Player[playerid][PlayerGang])
					{
						new tick = GetTickCount() - GangZone[i][ZoneLocked], msg[128];
						if(tick > (60000 * LOCKED_MINUTES))
						{
							format(msg, sizeof(msg), "Capturing ~g~%s", GangZone[i][ZoneName]);
							foreach(new p : Player)
							{
							if(Player[p][PlayerGang] == Player[playerid][PlayerGang])
								{
									if(Area_GetPlayerAreas(p, 0) == area)
									total++;
									PlayerTextDrawSetString(p, Player[p][CaptureTD][0], msg);
									PlayerTextDrawSetString(p, Player[p][CaptureTD][1], "-");
									PlayerTextDrawShow(p, Player[p][CaptureTD][0]);
									PlayerTextDrawShow(p, Player[p][CaptureTD][1]);
									Gang[Player[playerid][PlayerGang]][GangTimer] = CAPTURE_TIME;
								}
							}
							format(msg, sizeof(msg), "{FE9A2E}** %s gang trying to capture %s zone with %d gang member!", Gang[Player[playerid][PlayerGang]][GangName], GangZone[i][ZoneName], total);
							SendClientMessageToAll(-1, msg);
						    SendPlayerMessageToPlayer(0, playerid, "{FE9A2E}Before Gwar Make Sure you have disabled the GOTO Use /toggoto before gwar");
							GangZone[i][ZoneStatus] = true;
							GangZone[i][ZoneTimer] = SetTimerEx("AttackZone", 1000, true, "dd", Player[playerid][PlayerGang], i);
							Gang[Player[playerid][PlayerGang]][CurrentZone] = i;
							GangZoneFlashForAll(GangZone[i][ZoneHolder], HexToInt("FF0000AA"));
							if(GangZone[i][ZoneOwner] != -1)
							{
								format(msg, sizeof(msg), "{FF0000}* ALERT!!! %s gang trying to capture your territory in %s", Gang[Player[playerid][PlayerGang]][GangName], GangZone[i][ZoneName]);
								SendGangMessage(GangZone[i][ZoneOwner], msg);
							}
						}
						else
						{
							format(msg, sizeof(msg), "{FF0000}This Zone is locked, please wait %.2f minute(s) to capture!", floatdiv(60000 * LOCKED_MINUTES - tick, 60 * 1000));
							SendClientMessage(playerid, -1, msg);
						}
					}
					else
						SendClientMessage(playerid, -1, "{FF0000}Your gang already owned this zone!");
				}
				else
					SendClientMessage(playerid, -1, "{FF0000}Someone is trying to capture this zone!");
			}
			else
				SendClientMessage(playerid, -1, "{FF0000}You must be in gang zone to use this command!");
		}
		else
			SendClientMessage(playerid, -1, "{FF0000}Your gang already started a war, please wait!");
	}
	else
		SendClientMessage(playerid, -1, "{FF0000}You must be a gang member to use this command!");
	return 1;
}
so guys

Код:
{
	if (strcmp("/god", cmdtext, true, 10) == 0)
	{
		SendClientMessage(playerid, -1, "{FF0000}You Cant use this cmd in gwar!");
		return 1;
	}
	return 0;
}
we cant put something like this in the cmd of gwar ? becuase of the player will text god in gwar so the god cmd should not be use

i just want to say we cant have something like that when gwar going on so we can disable god cmd while gwar going ?
Reply
#2

PHP код:
new Cantuse[MAX_PLAYERS]; //on top of your script 
PHP код:
COMMAND:gwar(playeridparams[])
{
    if(
Player[playerid][PlayerGang] != -1)
    {
        if(
Gang[Player[playerid][PlayerGang]][CurrentZone] == -1)
        {
            new 
bool:found falseitotal 0area Area_GetPlayerAreas(playerid0);
            foreach(
GangZones)
            {
                if(
area == GangZone[i][ZoneArea])
                {
                    
found true;
                    break;
                }
            }
            if(
found)
            {
                if(!
GangZone[i][ZoneStatus])
                {
                    if(
GangZone[i][ZoneOwner] != Player[playerid][PlayerGang])
                    {
                        new 
tick GetTickCount() - GangZone[i][ZoneLocked], msg[128];
                        if(
tick > (60000 LOCKED_MINUTES))
                        {
                            
format(msgsizeof(msg), "Capturing ~g~%s"GangZone[i][ZoneName]);
                            foreach(new 
Player)
                            {
                            if(
Player[p][PlayerGang] == Player[playerid][PlayerGang])
                                {
                                    if(
Area_GetPlayerAreas(p0) == area)
                                    
total++;
                                    
PlayerTextDrawSetString(pPlayer[p][CaptureTD][0], msg);
                                    
PlayerTextDrawSetString(pPlayer[p][CaptureTD][1], "-");
                                    
PlayerTextDrawShow(pPlayer[p][CaptureTD][0]);
                                    
PlayerTextDrawShow(pPlayer[p][CaptureTD][1]);
                                    
Gang[Player[playerid][PlayerGang]][GangTimer] = CAPTURE_TIME;
                                }
                            }
                            
format(msgsizeof(msg), "{FE9A2E}** %s gang trying to capture %s zone with %d gang member!"Gang[Player[playerid][PlayerGang]][GangName], GangZone[i][ZoneName], total);
                            
SendClientMessageToAll(-1msg);
                            
SendPlayerMessageToPlayer(0playerid"{FE9A2E}Before Gwar Make Sure you have disabled the GOTO Use /toggoto before gwar");
                            
GangZone[i][ZoneStatus] = true;
                            
GangZone[i][ZoneTimer] = SetTimerEx("AttackZone"1000true"dd"Player[playerid][PlayerGang], i);
                            
Gang[Player[playerid][PlayerGang]][CurrentZone] = i;
                            
Cantuse[playerid] = 1;
                            
GangZoneFlashForAll(GangZone[i][ZoneHolder], HexToInt("FF0000AA"));
                            if(
GangZone[i][ZoneOwner] != -1)
                            {
                                
format(msgsizeof(msg), "{FF0000}* ALERT!!! %s gang trying to capture your territory in %s"Gang[Player[playerid][PlayerGang]][GangName], GangZone[i][ZoneName]);
                                
SendGangMessage(GangZone[i][ZoneOwner], msg);
                            }
                        }
                        else
                        {
                            
format(msgsizeof(msg), "{FF0000}This Zone is locked, please wait %.2f minute(s) to capture!"floatdiv(60000 LOCKED_MINUTES tick60 1000));
                            
SendClientMessage(playerid, -1msg);
                        }
                    }
                    else
                        
SendClientMessage(playerid, -1"{FF0000}Your gang already owned this zone!");
                }
                else
                    
SendClientMessage(playerid, -1"{FF0000}Someone is trying to capture this zone!");
            }
            else
                
SendClientMessage(playerid, -1"{FF0000}You must be in gang zone to use this command!");
        }
        else
            
SendClientMessage(playerid, -1"{FF0000}Your gang already started a war, please wait!");
    }
    else
        
SendClientMessage(playerid, -1"{FF0000}You must be a gang member to use this command!");
    return 
1;

PHP код:
if (strcmp("/god"cmdtexttrue10) == 0)
    {
        if(
Cantuse[playerid] == 1) return SendClientMessage(playerid, -1"{FF0000}You Cant use this cmd in gwar!");
        return 
1;
    } 
Where your gwar's cap timer ends add Cantuse[playerid] = 0; there
Reply
#3

thnx a lot bro ... :*
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)