/////////////////////////////////////////////////
//-----// Capture the TURTLE v 1.2 //-----//
//-----// //-----//
//-----// //-----//
//-----// coded by ReX&Ph03n1x (tAxI) //-----//
/////////////////////////////////////////////////
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// Based on tAxI's Capture The Shark
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#include <a_samp>
#include <dutils>
#include <dudb>
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
new sipkaz; // ganzones
new redz; // gangzones
new bluez; //ganzones
#define RED 0xFF0000AA
#define BLUE 0x0000BBAA
#define ORANGE 0xFF9900AA
#define GREEN 0x0AFF0AAA
#define GREY 0xAFAFAFAA
#define COLOUR_GREEN 0x33AA33AA
#define COLOUR_RED 0xAA3333AA
#define COLOUR_YELLOW 0xFFFF00AA
#define COLOUR_BLUE 0x0000BBAA
#define COLOUR_LIGHTBLUE 0x33CCFFAA
#define COLOUR_ORANGE 0xFF9900AA
#define COLOUR_RED 0xAA3333AA
#define COLOUR_LIME 0x10F441AA
#define COLOUR_MAGENTA 0xFF00FFFF
#define COLOUR_NAVY 0x000080AA
#define COLOUR_AQUA 0xF0F8FFAA
#define COLOUR_CRIMSON 0xDC143CAA
#define COLOUR_FLBLUE 0x6495EDAA
#define COLOUR_BISQUE 0xFFE4C4AA
#define COLOUR_BLACK 0x000000AA
#define COLOUR_CHARTREUSE 0x7FFF00AA
#define COLOUR_BROWN 0XA52A2AAA
#define COLOUR_CORAL 0xFF7F50AA
#define COLOUR_GOLD 0xB8860BAA
#define COLOUR_GREENYELLOW 0xADFF2FAA
#define COLOUR_INDIGO 0x4B00B0AA
#define COLOUR_IVORY 0xFFFF82AA
#define COLOUR_LAWNGREEN 0x7CFC00AA
#define COLOUR_SEAGREEN 0x20B2AAAA
#define COLOUR_LIMEGREEN 0x32CD32AA
#define COLOUR_MIDNIGHTBLUE 0X191970AA
#define COLOUR_MAROON 0x800000AA
#define COLOUR_OLIVE 0x808000AA
#define COLOUR_ORANGERED 0xFF4500AA
#define COLOUR_PINK 0xFFC0CBAA
#define COLOUR_SEAGREEN2 0x2E8B57AA //Had same name as another define
#define COLOUR_SPRINGGREEN 0x00FF7FAA
#define COLOUR_TOMATO 0xFF6347AA
#define COLOUR_YELLOWGREEN 0x9ACD32AA
#define COLOUR_MEDIUMAQUA 0x83BFBFAA
#define COLOUR_MEDIUMMAGENTA 0x8B008BAA
stock SystemMsg(playerid,msg[]) {
if ((IsPlayerConnected(playerid))&&(strlen(msg)>0)) {
SendClientMessage(playerid,COLOUR_AQUA,msg);
}
return 1;
}
stock PlayerName(playerid) {
new name[255];
GetPlayerName(playerid, name, 255);
return name;
}
enum playerinfo {
team,
flagged,
logged,
};
new PlayerInfo[MAX_PLAYERS][playerinfo];
new redflag;
new blueflag;
new redflagob;
new blueflagob;
new redscore;
new bluescore;
//new Score[256];
new Text:scoretext;
new Text:Clock;
forward ScoreUpdate();
forward updateText();
main()
{
print("\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
print(" Capture The Turtle [1.2 by ReX & Ph03n1x (& tAxI)]");
print("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n");
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(GetVehicleModel(vehicleid) == 520 || GetVehicleModel(vehicleid) == 425 || GetVehicleModel(vehicleid) == 476) {
if(PlayerInfo[playerid][flagged] == 1) {
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
SetPlayerPos(playerid,x+3,y+3,z+3);
SendClientMessage(playerid,RED,"You cant use these vehicles with TURTLE!");
return 1;
}
}
return 0;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/help", true) == 0) {
SendClientMessage(playerid,RED,"++^^__^^++>> Capture the TURTLE <<++^^__^^++");
SendClientMessage(playerid,ORANGE,"There are two teams - red & blue!");
SendClientMessage(playerid,ORANGE,"You must capture enemy 'flag' = turtle!");
SendClientMessage(playerid,ORANGE,"Have a fun! Dont forget: No-Cheat!");
SendClientMessage(playerid,COLOUR_GREEN,"Coded by ^ReX^Ph03n1x^t4x1 ");
SendClientMessage(playerid,RED,"-------------=================================-----------------");
return 1;
}
if(strcmp(cmdtext, "/news", true) == 0) {
SendClientMessage(playerid, COLOUR_GREEN, "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
SendClientMessage(playerid, RED, "News:");
SendClientMessage(playerid, ORANGE, "1.1 --- bug fixes, Anti-TK ");
SendClientMessage(playerid, ORANGE, "1.0 --- vypuљtмno");
SendClientMessage(playerid, COLOUR_GREEN, "_________________________________________________________");
return 1;
}
// DCMDS ----------------------------------//
dcmd(login,5,cmdtext); // protoze login ma 5 charu
dcmd(register,8,cmdtext); // protoze register login ma 8 charu
else
{
new string[256];
format(string, sizeof(string), "%s is an Unknown Command. Type /help for all the commands you can use.", cmdtext);
SendClientMessage(playerid, RED, string);
}
return 1;
}
/*
* /register password
*
*/
dcmd_register(playerid,params[]) {
// The command shouldn't work if we already are authed
if (PlayerInfo[playerid][logged]) return SystemMsg(playerid,"You are already authed.");
// The command shouldn't work if an account with this
// nick already exists
if (udb_Exists(PlayerName(playerid))) return SystemMsg(playerid,"Account doesnt exist, please use /login pass");
// Did he forgot the password?
if (strlen(params)==0) return SystemMsg(playerid,"[SYNTAX] Try: '/register PASSWORD'");
// We save the money to the accstate
if (udb_Create(PlayerName(playerid),params)) return SystemMsg(playerid,"[OK] Account created. Use /login PASS");
return true;
}
/*
* /login password
*
*/
dcmd_login(playerid,params[]) {
// The command shouldn't work if we already are authed
if (PlayerInfo[playerid][logged]) return SystemMsg(playerid,"[CHYBA] You are already authed.");
// The command shouldn't work if an account with this
// nick does not exists
if (!udb_Exists(PlayerName(playerid))) return SystemMsg(playerid,"[CHYBA] Account doesnt exist,please register.");
// Did he forgot the password?
if (strlen(params)==0) return SystemMsg(playerid,"[SYNTAX] Try: '/login PASSWORD'");
if (udb_CheckLogin(PlayerName(playerid),params)) {
// Login was correct
// Following thing is the same like the missing SetPlayerCommand
GivePlayerMoney(playerid,dUserINT(PlayerName(playerid)).("money")-GetPlayerMoney(playerid));
SetPlayerScore(playerid,dUserINT(PlayerName(playerid)).("score"));
PlayerInfo[playerid][logged] = 1;
return SystemMsg(playerid,"[OK] You are authed now [score and money back]!");
}
// Login was incorrect
return SystemMsg(playerid,"[ERROR] Bad password or other error!");
}
public OnPlayerConnect(playerid)
{
new playername[256],string[256];
GetPlayerName(playerid, playername, sizeof(playername));
format(string, sizeof(string), ">>> %s joined Capture The Turtle.(Connect) <<<", playername);
SendClientMessageToAll(GREY, string);
SendClientMessage(playerid,RED,"------------===========================----------------");
SendClientMessage(playerid,ORANGE,"Welcome in Capture the Turtle.");
SendClientMessage(playerid,GREEN,"Type /help for help about gamemode.");
SendClientMessage(playerid,RED,"------------===========================----------------");
TextDrawShowForPlayer(playerid,scoretext); // show team stats
TextDrawShowForPlayer(playerid,Clock); // show hodiny
SetPlayerMapIcon(playerid,1,-1101.5197,-984.9445,213.8505,30,0); // blue zelva
SetPlayerMapIcon(playerid,2,-1114.7848,-1621.3450,76.3739,20,0); // red zelva
PlayerInfo[playerid][logged] = 0;
return 1;
}
public OnPlayerDisconnect(playerid,reason)
{
new playername[MAX_PLAYER_NAME], string[256];
switch(reason)
{
case 0:
{
GetPlayerName(playerid, playername, sizeof(playername));
format(string, sizeof(string), "<<< %s left server.(Timeout) >>>", playername);
SendClientMessageToAll(GREY, string);
}
case 1:
{
GetPlayerName(playerid, playername, sizeof(playername));
format(string, sizeof(string), "<<< %s left server.(Leaving) >>>", playername);
SendClientMessageToAll(GREY, string);
}
case 2:
{
GetPlayerName(playerid, playername, sizeof(playername));
format(string, sizeof(string), "<<< %s left server.(Kicked) >>>", playername);
SendClientMessageToAll(GREY, string);
}
}
if (PlayerInfo[playerid][logged]==1) {
// Was loggedin, so save the data!
dUserSetINT(PlayerName(playerid)).("money",GetPlayerMoney(playerid));
dUserSetINT(PlayerName(playerid)).("score",GetPlayerScore(playerid));
}
PlayerInfo[playerid][logged]=false;
return 1;
}
public OnGameModeInit()
{
/*format(Score,sizeof(Score)," Red %d / Blue %d ",redscore,bluescore);
scoretext = TextDrawCreate(250.0,364.0,Score);
TextDrawColor(scoretext,RED);
TextDrawUseBox(scoretext, true);
TextDrawBoxColor(scoretext, BLUE);
TextDrawSetShadow(scoretext, 2);*/
// Team skore
scoretext=TextDrawCreate(250.0,364.0, "Blue 0:0 Red");
TextDrawLetterSize(scoretext, 0.6, 1.8);
TextDrawFont(scoretext, 3);
TextDrawSetOutline(scoretext, 1);
// hodiny
Clock=TextDrawCreate(547.0, 24.0, "00:00");
TextDrawLetterSize(Clock, 0.6, 1.8);
TextDrawFont(Clock, 3);
TextDrawSetOutline(Clock, 1);
//-------// end of TeXt DrAws
sipkaz = GangZoneCreate(-1132.754, -1611.547, -1074.365, -1097.72);
bluez = GangZoneCreate(-1307.922, -1121.076, -852.4849, -864.1628);
redz = GangZoneCreate(-1284.566, -1786.715, -817.4513, -1471.412);
SetTimer("updateText",60000,1);
SetTimer("ScoreUpdate",1000,1);
SetGameModeText("Capture The Turtle 1.2");
AddPlayerClass(73,-338.6469,2218.2136,42.4827,111.2697,0,0,0,0,0,0); // red
AddPlayerClass(78,-338.6469,2218.2136,42.4827,111.2697,0,0,0,0,0,0); // red
AddPlayerClass(95,-338.6469,2218.2136,42.4827,111.2697,0,0,0,0,0,0); // red
AddPlayerClass(100,-338.6469,2218.2136,42.4827,111.2697,0,0,0,0,0,0); // red
AddPlayerClass(122,-338.6469,2218.2136,42.4827,111.2697,0,0,0,0,0,0); // red
AddPlayerClass(133,-338.6469,2218.2136,42.4827,111.2697,0,0,0,0,0,0); // red
AddPlayerClass(163,-338.6469,2218.2136,42.4827,111.2697,0,0,0,0,0,0); // blue
AddPlayerClass(164,-338.6469,2218.2136,42.4827,111.2697,0,0,0,0,0,0); // blue
AddPlayerClass(170,-338.6469,2218.2136,42.4827,111.2697,0,0,0,0,0,0); // blue
AddPlayerClass(179,-338.6469,2218.2136,42.4827,111.2697,0,0,0,0,0,0); // blue
AddPlayerClass(287,-338.6469,2218.2136,42.4827,111.2697,0,0,0,0,0,0); // blue
CreateObject(8395,-1101.267,-984.257,170.067,0.0,0.0,0.0);
CreateObject(16644,-1103.027,-982.021,208.635,0.0,0.0,0.0);
CreateObject(16644,-1103.058,-985.931,208.654,0.0,0.0,0.0);
CreateObject(16644,-1103.040,-984.012,208.673,0.0,0.0,0.0);
CreateObject(3279,-1195.970,-1068.988,127.794,0.0,0.0,90.000);
CreateObject(3279,-1011.401,-1059.357,127.794,0.0,0.0,0.0);
CreateObject(3279,-1008.279,-915.203,127.919,0.0,0.0,-90.000);
CreateObject(3279,-1211.660,-918.294,127.518,0.0,0.0,11.250);
CreateObject(11292,-1195.286,-1062.273,129.458,0.0,0.0,-270.000);
CreateObject(16098,-1209.346,-1001.352,132.742,0.0,0.0,0.0);
CreateObject(3279,-1099.312,-1630.855,75.175,0.0,0.0,0.0);
CreateObject(974,-1093.910,-1615.051,78.145,0.0,0.0,0.0);
CreateObject(974,-1090.790,-1618.364,77.170,0.0,0.0,-90.000);
CreateObject(974,-1090.878,-1624.843,78.145,0.0,0.0,-90.000);
CreateObject(3279,-1093.269,-1619.296,74.793,0.0,0.0,-90.000);
CreateObject(3268,-1060.188,-1637.289,75.067,0.0,0.0,0.0);
CreateObject(16644,-1102.771,-984.192,215.208,0.0,0.0,0.0);
AddStaticVehicle(471,-1104.4807,-1643.3763,75.8496,276.3136,103,111); // red 1
AddStaticVehicle(471,-1104.2733,-1645.1262,75.8477,277.4761,120,114); // red 2
AddStaticVehicle(487,-1076.5822,-1617.5748,76.5472,279.6655,29,42); // red mave
AddStaticVehicle(520,-1077.7441,-1652.5253,77.0850,355.8386,0,0); // red hydra 1
AddStaticVehicle(425,-1118.0732,-1656.1080,76.9374,88.6492,43,0); // red hunter
AddStaticVehicle(495,-1053.8945,-1631.4775,76.7129,90.8798,119,122); // red sandking
AddStaticVehicle(411,-1054.0469,-1634.9119,76.0943,89.8757,64,1); // red infernus
AddStaticVehicle(522,-1057.9720,-1649.8513,76.4388,356.1379,3,8); // red nrg 1
AddStaticVehicle(522,-1059.2072,-1649.7261,76.3987,359.4299,7,79); // red nrg 2
AddStaticVehicle(522,-1060.2910,-1649.4978,76.3710,355.9668,6,25); // red nrg 3
AddStaticVehicle(502,-1062.8561,-1625.1573,76.2602,90.2283,36,88); // hotring red 1
AddStaticVehicle(504,-1055.8228,-1643.4645,77.1509,79.9065,57,38); // red bloodring banger
AddStaticVehicle(504,-1214.7867,-1015.5528,128.2264,267.7024,45,29); // BLUE bloodring banger
AddStaticVehicle(522,-1207.8546,-1026.7729,127.8614,271.4695,8,82); // BLUE NRG 1
AddStaticVehicle(522,-1208.1152,-1025.3529,127.8373,275.9184,36,105); // BLUE NRG 2
AddStaticVehicle(513,-1208.5746,-1042.7430,128.8442,268.5357,21,36); // BLUE stunt
AddStaticVehicle(495,-1213.3663,-1012.5892,128.6117,267.3834,118,117); // blue sandking
AddStaticVehicle(425,-1207.5157,-940.1960,129.0379,280.7116,43,0); // blue hunter // OPRAVA
AddStaticVehicle(520,-1205.7252,-981.9191,129.2189,269.0950,0,0); // hydra BLUE
AddStaticVehicle(434,-1214.4380,-1021.3092,128.3406,271.9251,12,12); // hotring BLUE
redflag = CreatePickup(1609,1,-1114.7848,-1621.3450,76.3739); // turtle red
blueflag = CreatePickup(1609,1,-1101.5197,-984.9445,213.8505); // turtle blue
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid,-338.8867,2218.2664,42.4826);
SetPlayerFacingAngle(playerid,107.9387);
SetPlayerCameraPos(playerid,-342.3423,2217.2151,42.4831);
SetPlayerCameraLookAt(playerid, -338.8867,2218.2664,42.4826);
if(classid < 6) {PlayerInfo[playerid][team] = 1; SetPlayerColor(playerid, RED);}
if(classid > 5) {PlayerInfo[playerid][team] = 2; SetPlayerColor(playerid, BLUE);}
switch (classid) {
case 0: {
GameTextForPlayer(playerid,"~r~Red Team (RED)",1000,6);
}
case 1: {
GameTextForPlayer(playerid,"~r~Red Team (RED)",1000,6);
}
case 2: {
GameTextForPlayer(playerid,"~r~Red Team (RED)",1000,6);
}
case 3: {
GameTextForPlayer(playerid,"~r~Red Team (RED)",1000,6);
}
case 4: {
GameTextForPlayer(playerid,"~r~Red Team (RED)",1000,6);
}
case 5: {
GameTextForPlayer(playerid,"~r~Red Team (RED)",1000,6);
}
case 6: {
GameTextForPlayer(playerid,"~b~Blue Team (BLUE)",1000,6);
}
case 7: {
GameTextForPlayer(playerid,"~b~Blue Team (BLUE)",1000,6);
}
case 8: {
GameTextForPlayer(playerid,"~b~Blue Team (BLUE)",1000,6);
}
case 9: {
GameTextForPlayer(playerid,"~b~Blue Team (BLUE)",1000,6);
}
case 10: {
GameTextForPlayer(playerid,"~b~Blue Team (BLUE)",1000,6);
}
}
return 1;
}
public OnPlayerRequestSpawn(playerid)
{
if (PlayerInfo[playerid][logged] == 0)
{
SendClientMessage(playerid,COLOUR_RED,"[CHYBA] Please login !!!");
GameTextForPlayer(playerid, "~r~ Please login !!!", 10000, 3);
return 0;
}
return 1;
}
public OnPlayerSpawn(playerid)
{
if(PlayerInfo[playerid][team] == 1) {
SetPlayerPos(playerid,-1110.6637,-1636.9218,76.3672); // RED
SetPlayerFacingAngle(playerid,175.6315);
SetPlayerColor(playerid, RED);
GivePlayerWeapon(playerid, 23, 500);
GivePlayerWeapon(playerid, 27, 100);
GivePlayerWeapon(playerid, 28, 1000);
GivePlayerWeapon(playerid, 30, 2000);
GivePlayerWeapon(playerid, 34, 50);
SetPlayerArmour(playerid,100);
}
else if(PlayerInfo[playerid][team] == 2) {
SetPlayerPos(playerid,-1195.6427,-1061.2258,129.2520); // BLUE
SetPlayerFacingAngle(playerid,272.2455);
SetPlayerColor(playerid, BLUE);
GivePlayerWeapon(playerid, 22, 500);
GivePlayerWeapon(playerid, 26, 200);
GivePlayerWeapon(playerid, 32, 1000);
GivePlayerWeapon(playerid, 31, 2000);
GivePlayerWeapon(playerid, 34, 50);
SetPlayerArmour(playerid,100);
}
//TextDrawShowForAll(Text:scoretext);
GangZoneShowForPlayer(playerid, redz, 0xFF000096);
GangZoneShowForPlayer(playerid, bluez, 0x0000FF96);
GangZoneShowForPlayer(playerid, sipkaz, 0xFF800096);
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
SendDeathMessage(killerid,playerid,reason);
if(killerid == INVALID_PLAYER_ID && PlayerInfo[playerid][team] == 2 && PlayerInfo[playerid][flagged] == 1) {
DisablePlayerCheckpoint(playerid);
PlayerInfo[playerid][flagged] = 0;
DestroyObject(redflagob);
SetPlayerColor(playerid,BLUE);
redflag = CreatePickup(1609,2,-1114.7848,-1621.3450,76.3739);
new string[256],playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
format(string,sizeof(string),"~n~~n~~g~%s died & returned ~r~Red ~g~Turtle!!!",playername);
GameTextForAll(string,2500,6);
}
if(killerid == INVALID_PLAYER_ID && PlayerInfo[playerid][team] == 1 && PlayerInfo[playerid][flagged] == 1) {
DisablePlayerCheckpoint(playerid);
PlayerInfo[playerid][flagged] = 0;
DestroyObject(redflagob);
SetPlayerColor(playerid,RED);
blueflag = CreatePickup(1609,2,-1101.5197,-984.9445,213.8505);
new string[256],playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
format(string,sizeof(string),"~n~~n~~g~%s died & returned ~b~Blue ~g~Turtle!!!",playername);
GameTextForAll(string,2500,6);
}
if(PlayerInfo[playerid][team] == 1 && PlayerInfo[playerid][flagged] == 1) {
DisablePlayerCheckpoint(playerid);
PlayerInfo[playerid][flagged] = 0;
DestroyObject(blueflagob);
SetPlayerColor(playerid,RED);
blueflag = CreatePickup(1609,2,-1101.5197,-984.9445,213.8505);
new string[256],playername[MAX_PLAYER_NAME];
GetPlayerName(killerid,playername,sizeof(playername));
format(string,sizeof(string),"~n~~n~~g~%s returned ~b~Blue ~g~Turtle!!!",playername);
GameTextForAll(string,2500,6);
}
if(PlayerInfo[playerid][team] == 2 && PlayerInfo[playerid][flagged] == 1) {
DisablePlayerCheckpoint(playerid);
PlayerInfo[playerid][flagged] = 0;
DestroyObject(redflagob);
SetPlayerColor(playerid,BLUE);
redflag = CreatePickup(1609,2,-1114.7848,-1621.3450,76.3739);
new string[256],playername[MAX_PLAYER_NAME];
GetPlayerName(killerid,playername,sizeof(playername));
format(string,sizeof(string),"~n~~n~~g~%s returned ~r~Red ~g~Turtle!!!",playername);
GameTextForAll(string,2500,6);
}
// Anti TeamKill //////////////////////////////////////////////////////////////////////////////////////////////
if(PlayerInfo[playerid][team] == PlayerInfo[killerid][team]){
SetPlayerScore(killerid, GetPlayerScore(killerid)-1);
ResetPlayerWeapons(killerid);
SendClientMessage(killerid, RED, "[ANTI-TK] You killed your team mate!");
}
//-----------------------------------------------------------------------------------------------------------//
return 1;
}
public OnPlayerText(playerid,text[])
{
if(text[0] == '!') {
new name[24], string[256];
GetPlayerName(playerid, name, 24);
format(string, sizeof(string), "[RADIO] %s: %s", name, text[1]);
for(new i = 0; i < MAX_PLAYERS; i++) {
if(IsPlayerConnected(i)) {
if(PlayerInfo[i][team] == PlayerInfo[playerid][team])
SendClientMessage(i, GetPlayerColor(playerid), string);
}
}
return 0;
}
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
if(PlayerInfo[playerid][team] == 1 && PlayerInfo[playerid][flagged] == 1) {
redscore++;
DisablePlayerCheckpoint(playerid);
PlayerInfo[playerid][flagged] = 0;
DestroyObject(blueflagob);
SetPlayerColor(playerid,RED);
blueflag = CreatePickup(1609,2,-1101.5197,-984.9445,213.8505);
new string[256],playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
format(string,sizeof(string),"~n~~n~~g~%s CAPTURED ~b~Blue ~g~Turtle!!!",playername);
GameTextForAll(string,5000,6);
new score = GetPlayerScore(playerid);
SetPlayerScore(playerid,score+1);
new odmena;
odmena = random(5);
switch(odmena)
{
case 0:
{
GivePlayerWeapon(playerid, 35, 2); // raketak 2 naboje
SendClientMessage(playerid,ORANGE,"Reward [RPG - 2 ammo]");
}
case 1:
{
GivePlayerWeapon(playerid, 37, 2000); // flamenak 2000 ammo
SendClientMessage(playerid,ORANGE,"Reward [FLAMETHROWER - 2000 ammo]");
}
case 2:
{
GivePlayerWeapon(playerid, 28, 3000); // MICRO SMG 3000 ammo
SendClientMessage(playerid,ORANGE,"Reward [MICRO SMG - 3000 ammo]");
}
}
//format(string,25,"Red %d:%d Blue",redscore,bluescore);
//TextDrawHideForPlayer(playerid,scoretext);
//TextDrawSetString(scoretext,string);
//TextDrawShowForPlayer(playerid,scoretext);
}
if(PlayerInfo[playerid][team] == 2 && PlayerInfo[playerid][flagged] == 1) {
bluescore++;
DisablePlayerCheckpoint(playerid);
PlayerInfo[playerid][flagged] = 0;
DestroyObject(redflagob);
SetPlayerColor(playerid,BLUE);
redflag = CreatePickup(1609,2,-1114.7848,-1621.3450,76.3739);
new string[256],playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
format(string,sizeof(string),"~n~~n~~g~%s CAPTURED ~r~Red ~g~Turtle!!!",playername);
GameTextForAll(string,5000,6);
new score = GetPlayerScore(playerid);
SetPlayerScore(playerid,score+1);
new odmena;
odmena = random(5);
switch(odmena)
{
case 0:
{
GivePlayerWeapon(playerid, 35, 2); // raketak 2 naboje
SendClientMessage(playerid,ORANGE,"Reward [RPG - 2 ammo]");
}
case 1:
{
GivePlayerWeapon(playerid, 37, 2000); // flamenak 2000 ammo
SendClientMessage(playerid,ORANGE,"Reward [FLAMETHROWER - 2000 ammo]");
}
case 2:
{
GivePlayerWeapon(playerid, 28, 3000); // MICRO SMG 3000 ammo
SendClientMessage(playerid,ORANGE,"Reward [MICRO SMG - 3000 ammo]");
}
}
//format(string,25,"Red %d:%d Blue",redscore,bluescore);
//TextDrawHideForPlayer(playerid,scoretext);
//TextDrawSetString(scoretext,string);
//TextDrawShowForPlayer(playerid,scoretext);
}
return 1;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == redflag && PlayerInfo[playerid][team] == 2) {
PlayerInfo[playerid][flagged] = 1;
SetPlayerCheckpoint(playerid,-1174.1277,-1063.4995,129.2188,8.0);
DestroyPickup(redflag);
SetPlayerColor(playerid,COLOUR_LIGHTBLUE);
redflagob = CreateObject(1609,0.1,0.1,0.1,0.1,0.1,0.1);
AttachObjectToPlayer(redflagob,playerid,0,0,3,0,0,0);
new string[256],playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
format(string,sizeof(string),"~n~~n~~g~%s stole ~r~Red ~g~Turtle!!!",playername);
GameTextForAll(string,2500,6);
return 1;
}
if(pickupid == blueflag && PlayerInfo[playerid][team] == 1) {
PlayerInfo[playerid][flagged] = 1;
SetPlayerCheckpoint(playerid,-1108.9479,-1650.7523,76.3672,8.0);
DestroyPickup(blueflag);
SetPlayerColor(playerid,COLOUR_ORANGERED);
blueflagob = CreateObject(1609,0.1,0.1,0.1,0.1,0.1,0.1);
AttachObjectToPlayer(blueflagob,playerid,0,0,3,0,0,0);
new string[256],playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
format(string,sizeof(string),"~n~~n~~g~%s stole ~b~Blue ~g~Turtle!!!",playername);
GameTextForAll(string,2500,6);
return 1;
}
return 0;
}
public updateText()
{
new string[256];
new stringh[256];
// time start
new hodina,minuta,s;
gettime(hodina,minuta,s);
if (minuta<= 9)
{
format(stringh,25,"%d:0%d",hodina,minuta);
}else{
format(stringh,25,"%d:%d",hodina,minuta);
}
//--------//
format(string,25,"Red %d:%d Blue",redscore,bluescore);
for(new i=0;i<MAX_PLAYERS;i++)
{
TextDrawHideForPlayer(i,scoretext);
TextDrawShowForPlayer(i,scoretext);
TextDrawHideForPlayer(i,Clock);
TextDrawShowForPlayer(i,Clock);
}
return 1;
}