Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- CTF round for Tactics v0.5 BETA
- started = 2 - CTF
- file setting's
- SpawnT1 = position
- SpawnT2 = position
- Interior = interior
- FlagPos = position
- */
- #include <a_samp>
- main()
- {
- print("\n----------------------------------");
- print(" Blank Gamemode by your name here");
- print("----------------------------------\n");
- }
- #define MAX_CTF 30
- enum cl
- {
- Float:apos[3],
- Float:dpos[3],
- inter,
- Float:fpos[3],
- flag,
- ach,
- dch
- };
- new cload[cl];
- /*
- PVar's:
- TM = Team
- inround = inround
- used
- */
- public OnGameModeInit()
- {
- return 1;
- }
- public OnGameModeExit()
- {
- endCTF();
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- //if(started == 2)
- //{
- if(GetPVarInt(playerid,"used") == 1)
- {
- RemovePlayerAttachedObject(playerid,0);
- new Float:sad[3];
- GetPlayerPos(playerid,sad[0],sad[1],sad[2]);
- cload[flag] = CreatePickup(1277,23,sad[0],sad[1],sad[2]);//spawn flag
- DestroyPickup(cload[ach]);
- DestroyPickup(cload[dch]);
- SetPVarInt(playerid,"used",0);
- }
- //}
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- //if(started == 2)
- //{
- SetPVarInt(playerid,"inround",1);
- switch(GetPVarInt(playerid,"TM"))
- {
- case 1:{//att
- SetPlayerPos(playerid,cload[apos][0],cload[apos][1],cload[apos][2]);
- SetPlayerInterior(playerid,cload[inter]);
- }
- case 2:{//def
- SetPlayerPos(playerid,cload[dpos][0],cload[dpos][1],cload[dpos][2]);
- SetPlayerInterior(playerid,cload[inter]);
- }
- }
- //}
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- //if(started == 2)
- //{
- if(GetPVarInt(playerid,"used") == 1)
- {
- RemovePlayerAttachedObject(playerid,0);
- new Float:sad[3];
- GetPlayerPos(playerid,sad[0],sad[1],sad[2]);
- cload[flag] = CreatePickup(1277,23,sad[0],sad[1],sad[2]);//spawn flag
- DestroyPickup(cload[ach]);
- DestroyPickup(cload[dch]);
- SetPVarInt(playerid,"used",0);
- }
- //}
- return 1;
- }
- public OnPlayerPickUpPickup(playerid, pickupid)
- {
- //if(started == 2)
- //{
- if(pickupid == cload[flag])
- {//flag pickup
- if(GetPVarInt(playerid,"used") == 0)
- {
- switch(GetPVarInt(playerid,"TM"))
- {
- case 1:{//att
- //addobj
- SetPVarInt(playerid,"used",1);
- SendClientMessageToAll(-1,"флаг стащили атакеры");
- cload[ach] = CreatePickup(1277,23,cload[dpos][0],cload[dpos][1],cload[dpos][2]);//spawn in def zone
- SetPlayerAttachedObject( playerid, 0, 2914, 15, 0.014013, 0.077415, -0.424313, 354.422760, 358.421966, 92.942932, 1.000000, 1.000000, 1.000000 );
- }
- case 2:{//def
- //addobj
- SetPVarInt(playerid,"used",1);
- SendClientMessageToAll(-1,"флаг стащили дефендеры");
- cload[dch] = CreatePickup(1277,23,cload[apos][0],cload[apos][1],cload[apos][2]);//spawn in att zone
- SetPlayerAttachedObject( playerid, 0, 2914, 15, 0.014013, 0.077415, -0.424313, 354.422760, 358.421966, 92.942932, 1.000000, 1.000000, 1.000000 );
- }
- }
- }
- DestroyPickup(cload[flag]);
- }
- if(pickupid == cload[ach])
- {
- if(GetPVarInt(playerid,"used") == 1)//used obj
- {
- if(GetPVarInt(playerid,"TM") == 2)//def player
- {
- //add score ++def
- SetPVarInt(playerid,"used",0);
- SendClientMessageToAll(-1,"дефы донесли таки флаг с зоны");
- cload[flag] = CreatePickup(1277,23,cload[fpos][0],cload[fpos][1],cload[fpos][2]);//spawn flag
- RemovePlayerAttachedObject(playerid,0);
- }
- }
- DestroyPickup(cload[ach]);
- }
- if(pickupid == cload[dch])
- {
- if(GetPVarInt(playerid,"used") == 1)//used obj
- {
- if(GetPVarInt(playerid,"TM") == 1)//att player
- {
- //add score ++att
- SetPVarInt(playerid,"used",0);
- SendClientMessageToAll(-1,"аттакеры донесли таки флаг с зоны");
- cload[flag] = CreatePickup(1277,23,cload[fpos][0],cload[fpos][1],cload[fpos][2]);//spawn flag
- RemovePlayerAttachedObject(playerid,0);
- }
- }
- DestroyPickup(cload[dch]);
- }
- //}
- return 1;
- }
- endCTF()
- {
- for(new x;x!=GetMaxPlayers();x++)
- {
- if(GetPVarInt(x,"used") == 1)
- {
- SetPVarInt(x,"used",0);
- RemovePlayerAttachedObject(x,0);
- }
- }
- DestroyPickup(cload[flag]);
- DestroyPickup(cload[ach]);
- DestroyPickup(cload[dch]);
- infoLeaders();
- }
- infoLeaders()
- {
- /*
- if(attflag > defflag) return setWin(att);
- else if(attflag < defflag) return setWin(def);
- else if(attflag == defflag) return setWin(nobody);
- */
- return true;
- }
- /*
- setWin(id)
- {
- //ляляля
- attflag = 0;
- defflag = 0;
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement