Help!
#5

Change SnakesFarm into ArmyHotel in the callbacks. You have done copy-and-paste but not learnt anything.

Quote:
Originally Posted by Sreyas
Посмотреть сообщение
PHP код:
#include <a_samp>
#include <zcmd>
#include <streamer>
#define ARMY 0 //Army Hotel
#define TEAM_Eurasia 0
#define TEAM_USA 1
#define TEAM_NONE
#define TEAM_ZONE_Eurasia_COLOR 0x15FF0055
#define TEAM_ZONE_USA_COLOR 0x0080FF55
#define C_RED 0xFF0000FF
#define red 0xFF0000AA
#define cred "{FF0000}"
#define green 0x33FF33AA
#define COLOR_WHITE "{FFFFFF}"
new tCP[2]; // tCP variable is presenting the team capture point.
new bool:UnderAttack[2]; // UnderAttack bool is presenting is that the zone under attacked or not. 
new CP[2]; // CP variable is presenting the Capture point
new Zone[2]; // Zone variable is presenting the Zone Area
new Captured[MAX_PLAYERS][2]; //Captured variable is presenting is that zone captured or not
new timer[MAX_PLAYERS][2]; // Timer variable is for zone capturing time
new CountVar[MAX_PLAYERS][2]; //Countvar variable is for zone countdown
new IsPlayerCapturing[MAX_PLAYERS][2];// IsPlayerCapturing Variable is to detect is that player capturing or not!
new gTeam[MAX_PLAYERS]; // This variable is to detect ur team mate.
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
    print(
"\n--------------------------------------");
    print(
" Blank Filterscript by your name here");
    print(
"--------------------------------------\n");
    return 
1;
}
public 
OnFilterScriptExit()
{
    return 
1;
}
#else
main()
{
    print(
"\n----------------------------------");
    print(
" Blank Gamemode by FrAnKiN");
    print(
"----------------------------------\n");
}
#endif
public OnGameModeInit()
{
    
// Don't use these lines if it's a filterscript
    
SetGameModeText("Blank Script");
    
AddPlayerClass(01958.37831343.157215.3746269.1425000000);
    return 
1;
}
{
        
tCP[ARMY] = TEAM_NONE// We set this team none so when the Game Mode start it would be capture by none team so all team can capture the zone.
        
CP[ARMY] = CreateDynamicCP(-551.5466,2593.7825,53.93483, -1, -1, -1100.0); // Ok this is an Zone co ordinates to create an zone u can paste ur co ordinates where u want to create an area
        
Zone[ARMY] = GangZoneCreate(-497.2638852657.306396, -632.6338502531.431152); // same as i said this is ur co ordinates add this
        
Create3DTextLabel"Army Hotel Capture Area"0xA00000FF, -497.2638852657.306396, -632.63385050.00); // you can also add create 3dlabel on that location but it's optional so u can skip this.
        
CreatePickup(13141, -551.54662593.782553.9348, -1);// And this is an also optional if u want add this u can otherwise u can skip it.
    
return 1;
}
public 
OnGameModeExit()
{
    return 
1;
}
public 
OnPlayerRequestClass(playeridclassid)
{
    
SetPlayerPos(playerid1958.37831343.157215.3746);
    
SetPlayerCameraPos(playerid1958.37831343.157215.3746);
    
SetPlayerCameraLookAt(playerid1958.37831343.157215.3746);
    return 
1;
}
public 
OnPlayerConnect(playerid)
{
    
IsPlayerCapturing[playerid][ARMY] = 0// So when player connect IsPlayerCapturing will be 0 otherwise you will face troubles in ur script
    
CountVar[playerid][ARMY] = 25// We Set Gang Zone time to 25 seconds that 25 representing 25 seconds
    
SetPlayerMapIcon(playerid2, -551.54662593.782553.934819MAPICON_GLOBAL); // This is an SetPlayerMapIcon to show ur zone on map you can also set this MAPICON_LOCAL then it would show when u go near to the zone
    
return 1;
}
public 
OnPlayerDisconnect(playeridreason)
{
if(
Captured[playerid][ARMY] == && IsPlayerCapturing[playerid][ARMY] == 1// This is now when u left so it would cancel the capturing to prevent bugging
{
     
LeavingArmyHotel(playerid); // This will contain some killtimer to stop capturing from the player and set it to normal condition
}
     return 
1;
}
public 
OnPlayerSpawn(playerid)
{
if(
Captured[playerid][ARMY] == && IsPlayerCapturing[playerid][ARMY] == 1// Ok this is the thing when u spawn so it would cancel the capturing to prevent bugging :)
{
     
LeavingArmyHotel(playerid); // // This will contain some killtimer to stop capturing from the player and set it to normal condition
}
    switch(
tCP[ARMY]) // Okay we are using switch here so it fast then if else structure
    
{
            case 
TEAM_NONE:      GangZoneShowForAll(Zone[ARMY], -66); // okay -66 is an simple White color and when the gamemode start it would be white
            
case TEAM_Eurasia:   GangZoneShowForAll(Zone[ARMY], TEAM_ZONE_Eurasia_COLOR); // if the zone is captured by team Eurasia then the zone would be green
            
case TEAM_USA:  GangZoneShowForAll(Zone[ARMY], TEAM_ZONE_USA_COLOR); // if the zone is captured by team USA then the zone would be blue
    
}
    return 
1;
}
public 
OnPlayerDeath(playeridkilleridreason)
{
if(
Captured[playerid][ARMY] == && IsPlayerCapturing[playerid][ARMY] == 1// This is now when u died so it would cancel the capturing to prevent bugging
{
     
LeavingArmyHotel(playerid);  //This is an if u leave the capture area then it would cancel as we all know :)
}
    return 
1;
}
CaptureZoneMessage(playeridmessageid); // we create this thing to safe our some time
{
    switch(
messageid// we create message id and 2 cases and we use them this in next steps
    
{
       case 
1:
       {
           
SendClientMessage(playeridred,"You cannot capture while in vehicle!");
       }
       case 
2:
       {
           
SendClientMessage(playeridred,"This zone is already being taken over by your team!");
       }
    }
    return 
1;
}
public 
OnVehicleSpawn(vehicleid)
{
    return 
1;
}
public 
OnVehicleDeath(vehicleidkillerid)
{
    return 
1;
}
public 
OnPlayerText(playeridtext[])
{
    return 
1;
}
public 
OnPlayerCommandText(playeridcmdtext[])
{
    if (
strcmp("/mycommand"cmdtexttrue10) == 0)
    {
        
// Do something here
        
return 1;
    }
    return 
0;
}
public 
OnPlayerEnterVehicle(playeridvehicleidispassenger)
{
    return 
1;
}
public 
OnPlayerExitVehicle(playeridvehicleid)
{
    return 
1;
}
public 
OnPlayerStateChange(playeridnewstateoldstate)
{
    return 
1;
}
public 
OnPlayerEnterCheckpoint(playerid)
{
    return 
1;
}
public 
OnPlayerLeaveCheckpoint(playerid)
{
    return 
1;
}
public 
OnPlayerEnterRaceCheckpoint(playerid)
{
    return 
1;
}
public 
OnPlayerLeaveRaceCheckpoint(playerid)
{
    return 
1;
}
public 
OnRconCommand(cmd[])
{
    return 
1;
}
public 
OnPlayerRequestSpawn(playerid)
{
    return 
1;
}
public 
OnObjectMoved(objectid)
{
    return 
1;
}
public 
OnPlayerObjectMoved(playeridobjectid)
{
    return 
1;
}
public 
OnPlayerPickUpPickup(playeridpickupid)
{
    return 
1;
}
public 
OnVehicleMod(playeridvehicleidcomponentid)
{
    return 
1;
}
public 
OnVehiclePaintjob(playeridvehicleidpaintjobid)
{
    return 
1;
}
public 
OnVehicleRespray(playeridvehicleidcolor1color2)
{
    return 
1;
}
public 
OnPlayerSelectedMenuRow(playeridrow)
{
    return 
1;
}
public 
OnPlayerExitedMenu(playerid)
{
    return 
1;
}
public 
OnPlayerInteriorChange(playeridnewinterioridoldinteriorid)
{
    return 
1;
}
public 
OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    return 
1;
}
public 
OnRconLoginAttempt(ip[], password[], success)
{
    return 
1;
}
public 
OnPlayerUpdate(playerid)
{
    return 
1;
}
public 
OnPlayerStreamIn(playeridforplayerid)
{
    return 
1;
}
public 
OnPlayerStreamOut(playeridforplayerid)
{
    return 
1;
}
public 
OnVehicleStreamIn(vehicleidforplayerid)
{
    return 
1;
}
public 
OnVehicleStreamOut(vehicleidforplayerid)
{
    return 
1;
}
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    return 
1;
}
public 
OnPlayerClickPlayer(playeridclickedplayeridsource)
{
    return 
1;
}
//==============================================================================
//=================[ OnPlayerEnter and OnPlayerLeave Dynamic CP]================
//==============================================================================
public OnPlayerEnterDynamicCP(playeridcheckpointid// we don't need to forward that cuz this is already public function so we don't need to forward that
// Bracket 1
if(checkpointid == CP[ARMY]) // So, When u enter on the zone all the process will be start from their.
    
// Bracket 2
             
if(UnderAttack[ARMY] == false)  // This is Checking is that zone in underattack or not if it is then it will not let you capture.
             
// bracket 3
                    
if(tCP[ARMY] != gTeam[playerid]) //This is checking that zone is captured by ur team or not if it's not u can capture if it's already capture by ur team u can't capture this zone 
                    
//bracket 4
                    
ActiveArmyHotel(playerid); // this is the main thing which is whole capture zone depend on.
                    
} else return SendClientMessage(playeridred,"*This zone is already captured by your team!");
              } else return 
CaptureZoneMessage(playerid2);
    }
    return 
1;
}
public 
OnPlayerLeaveDynamicCP(playeridcheckpointid// we don't need to forward that cuz this is already public function so we don't need to forward that
{
    if(
checkpointid == CP[ARMY] && Captured[playerid][ARMY] == && IsPlayerCapturing[playerid][ARMY] == && !IsPlayerInDynamicCP(playeridCP[ARMY])) // This is an if u leave the capture area then it would cancel as we all know :)
    
{
        
LeavingArmyHotel(playerid); // This function will contain some killtimer to stop capturing from the player and set it to normal condition
    
}
    return 
1;
}
//====================================================
//==================forward ActiveZone================
//==================Public ActiveZone=================
forward ActiveSnakeFarm(playerid);
public 
ActiveSnakeFarm(playerid)
{          
           if(
UnderAttack[ARMY] == false// This Variable is checking that the zone is capturing or not
           
{
                    if(!
IsPlayerInAnyVehicle(playerid)) //This thing is checking that the player is in vehicle or not
                    
{
                            
// switch(PlayerInfo[playerid][dRank]) //This is an optional Part if u don't want this u can skip but if u got Donor/Vip System in ur script this can be useful in ur script.
                             //{
                                // case 0: //donor level 0 means Normal Player
                                // {
                                        
timer[playerid][ARMY] = SetTimerEx("ArmyHotel"25000false,"i",playerid); // this is an timer of 25 seconds to capture an zone
                                        
CountVar[playerid][ARMY] = 25// as we set 25 second timer so we set zone timer 25 which mean 25 seconds we add this to here to prevent bugs
                                        
SendClientMessage(playerid0xFFFFFFFF,">> Stay in this checkpoint to capture!  <<");
                                   
//}
                                  /*case 1: //donor level 1
                                    {
                                        timer[playerid][ARMY] = SetTimerEx("SnakeFarm", 22000, false,"i",playerid);
                                        CountVar[playerid][ARMY] = 22;
                                        SendClientMessage(playerid, 0xFFFFFFFF,">> Stay in this checkpoint to capture!  <<");
                                    }
                                    case 2: //donor level 2
                                   {
                                        timer[playerid][ARMY] = SetTimerEx("SnakeFarm", 20000, false,"i",playerid);
                                                        CountVar[playerid][ARMY] = 20;
                                        SendClientMessage(playerid, 0xFFFFFFFF,">> Stay in this checkpoint to capture!  <<");
                                    }
                                    case 3: //donor level 3
                                    {
                                        timer[playerid][ARMY] = SetTimerEx("SnakeFarm", 17000, false,"i",playerid);
                                                        CountVar[playerid][ARMY] = 17;
                                        SendClientMessage(playerid, 0xFFFFFFFF,">> Stay in this checkpoint to capture!  <<");
                                    }
                                }*/
                                
UnderAttack[ARMY] = true// We set Under Attack to 1 so no one capture when u capturing this zone as jimmych got bugged of multiple capturing zone
                                
Captured[playerid][ARMY] = 0// We use this cause is still capturing it until it capture we can't set this to 1
                                
IsPlayerCapturing[playerid][ARMY] = 1// This variable means that player is capturing this zone if we add this in for(new loop or Foreach loop then it will start timer for each and each player who enter in this capture point so we don't need to use this in loop
                                
switch(gTeam[playerid]) // This Switch to for our team mates
                                    
{
                                            case 
TEAM_Eurasia:   GangZoneFlashForAll(Zone[ARMY], TEAM_ZONE_Eurasia_COLOR); //If Eurasia team is capturing then it would flash in Eurasia color which is green.
                                            
case TEAM_USA:  GangZoneFlashForAll(Zone[ARMY], TEAM_ZONE_USA_COLOR); // If USA team is capturing then it would flash in USA color which is blue..
                                    
}
                            
//------Message-----
                                
switch(tCP[ARMY])
                                    {
                                                case 
TEAM_NONE// This msg u will get when u capture it once
                                                        
{
                                                                
SendClientMessage(playeridCOLOR_WHITE,"This zone is not controlled by any team");
                                                        }
                                            case 
TEAM_Eurasia// This msg u will get when u capture it from Eurasia
                                                        
{
                                                                
SendClientMessage(playeridCOLOR_WHITE,"This flag is controlled by team <Eurasia>");
                                                                
SendTeamMessage(TEAM_Eurasiagreen,"*Snakes Farm is under attack!");
                                                        }
                                            case 
TEAM_USA:  // This msg u will get when u capture it from USA
                                                        
{
                                            
SendClientMessage(playeridCOLOR_WHITE,"This flag is controlled by team "C_RED"<USA>");
                                        
SendTeamMessage(TEAM_USAgreen,"*Snakes Farm is under attack!");
                                                        }
                                    }
            }
                    else return 
CaptureZoneMessage(playerid1);
                  }
                  else return 
CaptureZoneMessage(playerid2);
 
    return 
1;
}
 
forward SnakeFarmCaptured(playerid);
public 
SnakeFarmCaptured(playerid)
{
    
Captured[playerid][ARMY] = 1;//Now that variable is showed that the zone is belong to u
    
UnderAttack[ARMY] = false;  // This bool is false for now cuz that zone is captured and now it is not in under attack
    
IsPlayerCapturing[playerid][ARMY] = 0;// This is for now that no one capturing this zone.
    
KillTimer(timer[playerid][ARMY]); // It kill the timer to be prevent bugged
    
CountVar[playerid][ARMY] = 25// We set back to zone to 25 seconds
    
GivePlayerScore(playerid5); // Okay we are giving 5 score to that person who capture this zone
    
GivePlayerMoney(playerid5000);// Same we giving the player 5000$ for capturing Army Hotel
    
SendClientMessage(playeridgreen,"You got +5 scores and +$5000 cash for this area!");
 
    
//==========================================================================
    
foreach(Playeri// Foreach loop cuz it's efficient
    
{
       if(
gTeam[i] == gTeam[playerid] && != playerid// first thing we create this loop to give all team mates 1 score as an reward
       
{
           
SendClientMessage(i0xFFFFFFFF,"*Your team has captured "cred"Army Hotel"cwhite"! You received +1 score for it!");
           
GivePlayerScore(i1); // Giving score to all of them
       
}
    }
    
//==========================================================================
    
tCP[ARMY] = gTeam[playerid]; // Now we go to that zone to stop the flash.
    
GangZoneStopFlashForAll(Zone[ARMY]);
    
//==========================================================================
    
switch(gTeam[playerid]) // this is switch to stop flash for all teams
    
{
            case 
TEAM_Eurasia:   GangZoneShowForAll(Zone[ARMY], TEAM_ZONE_Eurasia_COLOR);
            case 
TEAM_USA:  GangZoneShowForAll(Zone[ARMY], TEAM_ZONE_USA_COLOR);
   }
    
//==========================================================================
        
return 1;
}
 
forward LeavingSnakeFarm(playerid);
public 
LeavingSnakeFarm(playerid)
{
    
Captured[playerid][ARMY] = 1// Okay this is 1 cuz it let the current team player that the zone is still belong to old team when u left
    
UnderAttack[ARMY] = false// We set underattack bool to false cuz the old player left the snake farm
    
KillTimer(timer[playerid][ARMY]); // Okay we killing the timer.
    
CountVar[playerid][ARMY] = 25// We set the zone back to it's 25 seconds
    
GangZoneStopFlashForAll(Zone[ARMY]); // We set the snake to stop it flash
    
SendClientMessage(playeridred,"*You have been failed to capture this zone!");
    
IsPlayerCapturing[playerid][ARMY] = 0// We set the zone that the zone u left it become 0 cuz u left it :D
return 1;
}
forward ArmyHotel(playerid);
public 
ArmyHotel(playerid)
{
    
ArmyHotelCaptured(playerid); // this timer will be over on 25 second and then it will capture OH YEA :D
    
return 1;
}
 
GivePlayerScore(playeridscore)
{
        
SetPlayerScore(playeridGetPlayerScore(playerid)+5);
        return 
1;

there was an unneccessary bracket
LOL
Reply


Messages In This Thread
Help! - by FrAnKiN1 - 14.07.2016, 22:03
Re: Help! - by FrAnKiN1 - 14.07.2016, 23:39
Re: Help! - by FrAnKiN1 - 15.07.2016, 11:42
Re: Help! - by SyS - 15.07.2016, 11:46
Re: Help! - by Logic_ - 15.07.2016, 11:47
Re: Help! - by GhostHacker - 15.07.2016, 11:54
Re: Help! - by SyS - 15.07.2016, 12:05
Re: Help! - by FrAnKiN1 - 15.07.2016, 12:32
Re: Help! - by Logic_ - 15.07.2016, 13:11
Re: Help! - by SyS - 15.07.2016, 13:14

Forum Jump:


Users browsing this thread: 1 Guest(s)