08.02.2011, 13:15
pawn Код:
//******************************************************************************
//* [FS] VOTEMAP by AVANGARD
//*
//* Ęąėźą˙ ģī˙ ļīļūņźą ķеģķīćī ļљčįėčēčņь ģуėьņčļėеељ SAMP ź
//* ļīļуė˙љķīģу 3D ųуņељу Counter-Strike
//* Ńźљčļņ ļљедīńņąāėеķ ńąйņīģ http://www.samp-rus.com
//******************************************************************************
#include <a_samp>
#define COLOR_GOLD 0xF7DFB5AA
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_RED 0xFF0000AA
#define COLOR_BLUE 0x0000BBAA
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_DARKRED 0x660000AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_YELLOW 0xFFFF00FF
forward ExitGameMode();
forward DMTimer();
forward ExitTheGameMode();
forward OnPlayerUpdate(playerid);
forward ChangeMode();
forward OnPlayerReadStat(playerid);
forward OnPlayerSpectat(playerid);
forward ShowStats(playerid);
forward GetVal(string[]);
forward fcreate(filename[]);
forward UnsetVoting();
new voteON=1;//Āźė čėč Āūźė āīēģīęķīńņь ńģеķū ģīдą чељеē ćīėīńīāąķčе
new AutoChangeMode=1;//Āźė čėč Āūźė āīēģīęķīńņь ńģеķū ģīдą ąāņīģąņčчеńźč
new vinVote[256];
new Menu:voteMenu;
new pVote;
new vote[12];
new gvote[12];
new PlayerVote[MAX_PLAYERS];
new players;
new DMTime;// Āљеģ˙ љąуķдą ā ńеźуķдąх
new DMT;
new ExitGM;
new UnSV;
new TimerSpec;
new tmp[256];
new RetVal;
new PlayerSpectating[MAX_PLAYERS];
new pID;
enum pStat
{
pKills,
pDeaths,
pScore,
pRatio,
};
new PlayerInfo[MAX_PLAYERS][pStat];
new rand;
new Maps[12][128] = {
{"....."}, //1
{"....."}, //2
{"....."}, //3
{"....."}, //4
{"....."}, //5
{"..,,,"}, //6
{",,,,,"}, //7
{",,,,,"}, //8
{",,,,,"}, //9
{",,,,,"}, //10
{",,,,,"}, //11
{",,,,,"} //12
};
stock TimeConvert(seconds) {
new minutes = floatround(seconds/60);
seconds -= minutes*60;
format(tmp, sizeof(tmp), "%d:%02d", minutes, seconds);
return tmp;
}
//**************************************************************************
strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}
public OnFilterScriptInit()
{
print("\n--------------------------------------------");
print(" VOTEMAP FILTERSCRIPT by AVANGARD ");
print(" LOAD..... ");
print(" Script Provided by http://www.samp-rus.com ");
print("--------------------------------------------\n");
UnSV = SetTimer("UnsetVoting", 120000,1);
return 1;
}
public OnFilterScriptExit()
{
print("\n----------------------------------");
print(" Filterscript VOTEMAP UNLOAD.... ");
print("----------------------------------\n");
return 1;
}
public OnGameModeInit()
{
new string[256];
voteMenu = CreateMenu("MO‘",2,490,145,100,100);
format(string, sizeof(string), "1.%s", Maps[0]);
AddMenuItem(voteMenu, 0, string); //0
format(string, sizeof(string), "2.%s", Maps[1]);
AddMenuItem(voteMenu, 0, string); //1
format(string, sizeof(string), "3.%s", Maps[2]);
AddMenuItem(voteMenu, 0, string); //2
format(string, sizeof(string), "4.%s", Maps[3]);
AddMenuItem(voteMenu, 0, string); //3
format(string, sizeof(string), "5.%s", Maps[4]);
AddMenuItem(voteMenu, 0, string); //4
format(string, sizeof(string), "6.%s", Maps[5]);
AddMenuItem(voteMenu, 0, string); //5
format(string, sizeof(string), "7.%s", Maps[6]);
AddMenuItem(voteMenu, 0, string); //6
format(string, sizeof(string), "8.%s", Maps[7]);
AddMenuItem(voteMenu, 0, string); //7
format(string, sizeof(string), "9.%s", Maps[8]);
AddMenuItem(voteMenu, 0, string); //8
format(string, sizeof(string), "10.%s", Maps[9]);
AddMenuItem(voteMenu, 0, string); //9
format(string, sizeof(string), "11.%s", Maps[10]);
AddMenuItem(voteMenu, 0, string); //10
//UnSV = SetTimer("UnsetVoting", 60000,1);
//SetTimer("UnsetVoting", 60000, 1);
ExitGM = SetTimer("ExitGameMode", 1000, 1);
TimerSpec = SetTimer("OnPlayerSpectat", 1000, 1);
rand = random(sizeof(Maps));
pVote = players/2+2;
DMTime = 1800; // Āљеģ˙ ķą ćейģģīд ā ńеźуķдąх
if(AutoChangeMode == 1)
{
//900
DMT = SetTimer("DMTimer", 1000, 1);
}
UnsetVoting();
return 1;
}
public OnGameModeExit()
{
KillTimer(DMT);
KillTimer(ExitGM);
DestroyMenu(voteMenu);
KillTimer(TimerSpec);
KillTimer(UnSV);
return 1;
}
public OnPlayerConnect(playerid)
{
PlayerSpectating[playerid] = 0;
PlayerVote[playerid] = 0;
players++;
SendClientMessage(playerid,COLOR_WHITE,"******************************************************************");
SendClientMessage(playerid,COLOR_WHITE,"* [FS]VOTEMAP by AVANGARD ");
SendClientMessage(playerid,COLOR_WHITE,"* 2008ć. ");
SendClientMessage(playerid,COLOR_WHITE,"* Ķąįељčņе 'vhelp' дė˙ ļīėучеķč˙ ļīģīłč! ");
SendClientMessage(playerid,COLOR_WHITE,"* Ńźљčļņ ļљедīńņąāėеķ ńąйņīģ http://www.samp-rus.com ");
SendClientMessage(playerid,COLOR_WHITE,"******************************************************************");
OnPlayerReadStat(playerid);
}
public OnPlayerDisconnect(playerid, reason)
{
if(PlayerSpectating[playerid] == 1)
{
new playername[256];
GetPlayerName(playerid,playername,sizeof(playername));
strdel(playername, 0, 6);
SetPlayerName(playerid, playername);
}
players--;
return 1;
}
public OnPlayerSpawn(playerid)
{
if(PlayerSpectating[playerid] == 1)
{
new playername[256];
GetPlayerName(playerid,playername,sizeof(playername));
strdel(playername, 0, 6);
SetPlayerName(playerid, playername);
SpawnPlayer(playerid);
}
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
PlayerInfo[playerid][pDeaths] += 1;
OnPlayerUpdate(playerid);
PlayerInfo[killerid][pKills] += 1;
OnPlayerUpdate(killerid);
return 1;
}
public OnPlayerText(playerid,text[])
{
new string[256];
new playername[256];
GetPlayerName(playerid,playername,sizeof(playername));
new idx;
tmp = strtok(text, idx);
//********************Āūēīā ģеķћ дė˙ ćīėīńīāąķč˙************************//
if((strcmp("votemap", tmp, true, strlen(tmp)) == 0))
{
if(voteON==1)
{
ShowMenuForPlayer(voteMenu, playerid);
TogglePlayerControllable(playerid,0);
return 1;
}
else
{
SendClientMessage(playerid,COLOR_RED, "SERVER: Ćīėīńīāąķčе ēą ńģеķу āūźėћчеķī ąдģčķčńņљąņīљīģ!");
}
return 0;
}
//**********************Ļīźąēūāąеņ ńėедућłčй ćейģģīд***************************//
if((strcmp("nextmap", tmp, true, strlen(tmp)) == 0))
{
format(string, sizeof(string), "***Ńėедућłčй ćейģģīд ''%s''", Maps[rand]);
SendClientMessageToAll(COLOR_LIGHTBLUE, string);
return 1;
}
//***********************Āљеģ˙ дī ńģеķū ćейģģīдą*****************************//
if((strcmp("timeleft", tmp, true, strlen(tmp)) == 0))
{
format(string, sizeof(string), "***Дī ńģеķū ćейģģīдą īńņąėīńь %s", TimeConvert(DMTime));
SendClientMessageToAll(COLOR_LIGHTBLUE, string);
return 1;
}
//************************Āūāīдčņ ńņąņčńņčźу******************************//
if((strcmp("rank", tmp, true, strlen(tmp)) == 0))
{
ShowStats(playerid);
return 1;
}
//***********************Āūāīд čķōīљģąцčč дė˙ ąдģčķą*****************************//
if((strcmp("voteinfo", tmp, true, strlen(tmp)) == 0))
{
if(IsPlayerAdmin(playerid))
{
SendClientMessage(playerid,COLOR_LIGHTBLUE,"***************ČĶŌĪЉĢĄЦČЯ*****************");
if(voteON==1)
{
format(string, sizeof(string), "*Ńģеķą ģīдą ļī ćīėīńīāąķčћ: Āźėћчеķī");
SendClientMessage(playerid,COLOR_LIGHTBLUE, string);
}
else
{
format(string, sizeof(string), "*Ńģеķą ģīдą ļī ćīėīńīāąķčћ: Āūźėћчеķī");
SendClientMessage(playerid,COLOR_LIGHTBLUE, string);
}
if(AutoChangeMode==1)
{
format(string, sizeof(string), "*Ąāņīģąņčчеńźą˙ ńģеķą ģīдą: Āźėћчеķī");
SendClientMessage(playerid,COLOR_LIGHTBLUE, string);
SendClientMessage(playerid,COLOR_LIGHTBLUE,"******************************************************");
}
else
{
format(string, sizeof(string), "*Ąāņīģąņčчеńźą˙ ńģеķą ģīдą: Āūźėћчеķī");
SendClientMessage(playerid,COLOR_LIGHTBLUE, string);
SendClientMessage(playerid,COLOR_LIGHTBLUE,"******************************************************");
}
return 1;
}
else
{
SendClientMessage(playerid,COLOR_RED, "SERVER: Āąģ ķе ļīēāīėеķī čńļīėьēīāąņь żņу źīģąķду!");
return 1;
}
}
//************************Āūāīдčņ ļīģīłь******************************//
if((strcmp("vhelp", tmp, true, strlen(tmp)) == 0))
{
SendClientMessage(playerid, COLOR_WHITE, "*****************************************ĻĪĢĪŁЬ*************************************************");
SendClientMessage(playerid, COLOR_WHITE, "*Īńķīāķūе źīģąķдū: votemap - ēąļуńņčņь ćīėīńīāąķčе ēą ńģеķу ģīдą");
SendClientMessage(playerid, COLOR_WHITE, " nextmap - ļљīńģīņљ ńėедудуеłеćī ģīдą āūįљąķķīćī ńељāељīģ");
SendClientMessage(playerid, COLOR_WHITE, " timeleft - āљеģ˙ дī ąāņīģąņčчеńźīй ńģеķū ģīдą āūįљąķķīćī ńељāељīģ");
SendClientMessage(playerid, COLOR_WHITE, " rank - ļљīńģīņљ ńāīей ńņąņčńņčźč");
SendClientMessage(playerid, COLOR_WHITE, " kill - уįčņь ńеį˙");
SendClientMessage(playerid, COLOR_WHITE, " /name [ĶČŹ] - ńģеķą ķčźą");
SendClientMessage(playerid, COLOR_WHITE, " ahelp - ļīģīłь ąдģčķčńņљąņīљąģ");
SendClientMessage(playerid, COLOR_RED, " ĀĶČĢĄĶČЕ!!! Źīģąķдū ķąįčљąћņń˙ ā чąņе įеē ńčģāīėą '/'!!!");
SendClientMessage(playerid, COLOR_WHITE, "*************************************************************************************************************");
return 1;
}
//**********************Ļīģīłь ąдģčķąģ*******************************//
if((strcmp("ahelp", tmp, true, strlen(tmp)) == 0))
{
if(IsPlayerAdmin(playerid))
{
SendClientMessage(playerid, COLOR_WHITE, "************************ĻĪĢĪŁЬ ĄДĢČĶČŃŅЉĄŅĪЉĄĢ**************************");
SendClientMessage(playerid, COLOR_WHITE, "*Īńķīāķūе źīģąķдū: voteinfo - ļљīńģīņљ ķąńņљīеź ńźљčļņą");
SendClientMessage(playerid, COLOR_WHITE, " spect/spectoff - āхīд/āūхīд ā љеęčģ ķąįėћдеķč˙");
SendClientMessage(playerid, COLOR_WHITE, " /voting [on/off] - āźė/āūźė ńģеķū ģīдą ļī ćīėīńīāąķčћ");
SendClientMessage(playerid, COLOR_WHITE, " /achange [on/off] - āźė/āūźė ńģеķū ģīдą āņīģąņčчеńźč");
SendClientMessage(playerid, COLOR_WHITE, "*****************************************************************************************");
}
else
{
SendClientMessage(playerid, COLOR_RED, "SERVER: Āąģ ķе ļīēāīėеķī čńļīėьēīāąņь żņу źīģąķду!");
}
return 1;
}
//************************Ļељехīд ā љеęčģ ķąįėћдąņеė˙***********************//
if((strcmp("spect", tmp, true, strlen(tmp)) == 0))
{
if(IsPlayerAdmin(playerid) && PlayerSpectating[playerid] == 0)
{
PlayerSpectating[playerid]=1;
format(string, sizeof(string), "***Čćљīź %s ļељеųшė ā љеęčģ ķąįėћдеķč˙",playername);
SendClientMessageToAll(COLOR_WHITE, string);
strins(playername,"[SPEC]",0);
SetPlayerName(playerid, playername);
return 0;
}
else
{
SendClientMessage(playerid,COLOR_RED, "SERVER: Āąģ ķе ļīēāīėеķī čńļīėьēīāąņь żņу źīģąķду!");
return 0;
}
}
//*************************Āūхīд čē љеęčģą ķąįėћдеķč˙****************************//
if((strcmp("spectoff", tmp, true, strlen(tmp)) == 0))
{
if(PlayerSpectating[playerid] == 1)
{
format(string, sizeof(string), "***Čćљīź %s āељķуėń˙ ā čćљу",playername);
SendClientMessageToAll(COLOR_WHITE, string);
PlayerSpectating[playerid] = 0;
TogglePlayerSpectating(playerid, 0);
SetCameraBehindPlayer(playerid);
strdel(playername, 0, 6);
SetPlayerName(playerid, playername);
OnPlayerSpawn(playerid);
return 0;
}
else
{
SendClientMessage(playerid, COLOR_RED, "SERVER: Āū ķе ā љеęčģе ķąįėћдеķč˙!");
}
}
//**********************Ńąģīуįčйńņāī****************************//
if((strcmp("kill", tmp, true, strlen(tmp)) == 0))
{
SetPlayerHealth(playerid, 0);
return 0;
}
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
new string[256];
new cmd[256],idx;
cmd = strtok(cmdtext, idx);
new playername[256];
GetPlayerName(playerid,playername,sizeof(playername));
//**************Āźėћчеķčе/Āūźėћчеķčе ńģеķū ģīдą ļī ćīėīńīāąķčћ**************//
if(strcmp(cmd, "/voting", true) == 0)
{
if(IsPlayerAdmin(playerid))
{
new pos[256];
pos = strtok(cmdtext, idx);
if(!strlen(pos))
{
SendClientMessage(playerid, COLOR_WHITE, " ČŃĻĪĖЬĒĪĀĄĶČЕ: /voting [ON/OFF]");
return 1;
}
if(strcmp(pos,"on",true) == 0)
{
format(string, sizeof(string), "*Ńģеķą ģīдą ļī ćīėīńīāąķčћ: Āźėћчеķī");
SendClientMessage(playerid,COLOR_WHITE, string);
voteON=1;
}
if(strcmp(pos,"off",true) == 0)
{
format(string, sizeof(string), "*Ńģеķą ģīдą ļī ćīėīńīāąķčћ: Āūźėћчеķī");
SendClientMessage(playerid,COLOR_WHITE, string);
voteON=0;
}
}
else
{
SendClientMessage(playerid,COLOR_RED, "SERVER: Āąģ ķе ļīēāīėеķī čńļīėьēīāąņь żņу źīģąķду!");
return 1;
}
return 1;
}
//**************Āźėћчеķčе/Āūźėћчеķčе ąāņīģąņčчеńźīй ńģеķū ģīдą**************//
if(strcmp(cmd, "/achange", true) == 0)
{
if(IsPlayerAdmin(playerid))
{
new pos[256];
pos = strtok(cmdtext, idx);
if(!strlen(pos))
{
SendClientMessage(playerid, COLOR_WHITE, " ČŃĻĪĖЬĒĪĀĄĶČЕ: /achange [ON/OFF]");
return 1;
}
if(strcmp(pos,"on",true) == 0)
{
format(string, sizeof(string), "*Ąāņīģąņčчеńźą˙ ńģеķą ģīдą: Āźėћчеķī");
SendClientMessage(playerid,COLOR_WHITE, string);
AutoChangeMode=1;
}
if(strcmp(pos,"off",true) == 0)
{
format(string, sizeof(string), "*Ąāņīģąņčчеńźą˙ ńģеķą ģīдą: Āūźėћчеķī");
SendClientMessage(playerid,COLOR_WHITE, string);
AutoChangeMode=0;
}
}
else
{
SendClientMessage(playerid,COLOR_RED, "SERVER: Āąģ ķе ļīēāīėеķī čńļīėьēīāąņь żņу źīģąķду!");
return 1;
}
return 1;
}
//*************************Ńģеķą ķčźą ā čćље********************************
if (strcmp(cmd, "/name", true)==0)
{
new nicktmp[19];
format(nicktmp, sizeof(nicktmp), "%s", strtok(cmdtext, idx));
//new string2[256];
if(!strlen(nicktmp))
{
SendClientMessage(playerid, COLOR_RED, " ČŃĻĪĖЬĒĪĀĄĶČЕ: /name [ķīāūй ķčź]");
return 1;
}
else
{
if(strlen(nicktmp) < 3)
{
SendClientMessage(playerid, COLOR_RED, "SERVER: Cėčųźīģ źīљīņźčй ķčź!");
return 1;
}
else if(strlen(nicktmp) > 16)
{
SendClientMessage(playerid, COLOR_RED, "SERVER: Cėčųźīģ дėčķūй ķčź!");
return 1;
}
else
{
format(string, sizeof(string), "%s ńģеķčė čģ˙ ķą %s", playername, nicktmp);
SendClientMessage(playerid,COLOR_WHITE, string);
//format(string2, sizeof(string2), "PlayersStat/%s.txt", nicktmp);
//fremove(string2);
SetPlayerName(playerid, nicktmp);
OnPlayerUpdate(playerid);
return 1;
}
}
}
return 0;
}
public OnPlayerSelectedMenuRow(playerid, row)
{
new string[256];
new playername[256];
GetPlayerName(playerid,playername,sizeof(playername));
if(GetPlayerMenu(playerid) == voteMenu)
{switch(row)
{
case 0:
{
if(PlayerVote[playerid]!=0)
{
format(string, sizeof(string), "***Ēą ''%s'' ļљīćīėīńīāąėī %d чеėīāеź", Maps[0], vote[0]);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
SendClientMessage(playerid, COLOR_LIGHTBLUE, "***Āū уęе ļљīćīėīńīāąėč!");
TogglePlayerControllable(playerid, 1);
}
else
{
gvote[0]--;
format(string, sizeof(string), "*** %s ļљīćīėīńīāąė ēą ''%s'', īńņąėīńь ćīėīńīā: %d", playername, Maps[0], gvote[0]);
SendClientMessageToAll(COLOR_LIGHTBLUE, string);
TogglePlayerControllable(playerid, 1);
PlayerVote[playerid]=1;
vote[0]++;
}
}
case 1:
{
if(PlayerVote[playerid]!=0)
{
format(string, sizeof(string), "***Ēą ''%s'' ļљīćīėīńīāąėī %d чеėīāеź", Maps[1], vote[1]);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
SendClientMessage(playerid, COLOR_LIGHTBLUE, "***Āū уęе ļљīćīėīńīāąėč!");
TogglePlayerControllable(playerid, 1);
}
else
{
gvote[1]--;
format(string, sizeof(string), "*** %s ļљīćīėīńīāąė ēą ''%s'', īńņąėīńь ćīėīńīā: %d", playername, Maps[1], gvote[1]);
SendClientMessageToAll(COLOR_LIGHTBLUE, string);
TogglePlayerControllable(playerid, 1);
PlayerVote[playerid]=1;
vote[1]++;
}
}
case 2:
{
if(PlayerVote[playerid]!=0)
{
format(string, sizeof(string), "***Ēą ''%s'' ļљīćīėīńīāąėī %d чеėīāеź", Maps[2], vote[2]);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
SendClientMessage(playerid, COLOR_LIGHTBLUE, "***Āū уęе ļљīćīėīńīāąėč!");
TogglePlayerControllable(playerid, 1);
}
else
{
gvote[2]--;
format(string, sizeof(string), "*** %s ļљīćīėīńīāąė ēą ''%s'', īńņąėīńь ćīėīńīā: %d", playername, Maps[2], gvote[2]);
SendClientMessageToAll(COLOR_LIGHTBLUE, string);
TogglePlayerControllable(playerid, 1);
PlayerVote[playerid]=1;
vote[2]++;
}
}
case 3:
{
if(PlayerVote[playerid]!=0)
{
format(string, sizeof(string), "***Ēą ''%s'' ļљīćīėīńīāąėī %d чеėīāеź", Maps[3], vote[3]);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
SendClientMessage(playerid, COLOR_LIGHTBLUE, "***Āū уęе ļљīćīėīńīāąėč!");
TogglePlayerControllable(playerid, 1);
}
else
{
gvote[3]--;
format(string, sizeof(string), "*** %s ļљīćīėīńīāąė ēą ''%s'', īńņąėīńь ćīėīńīā: %d", playername, Maps[3], gvote[3]);
SendClientMessageToAll(COLOR_LIGHTBLUE, string);
TogglePlayerControllable(playerid, 1);
PlayerVote[playerid]=1;
vote[3]++;
}
}
case 4:
{
if(PlayerVote[playerid]!=0)
{
format(string, sizeof(string), "***Ēą ''%s'' ļљīćīėīńīāąėī %d чеėīāеź", Maps[4], vote[4]);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
SendClientMessage(playerid, COLOR_LIGHTBLUE, "***Āū уęе ļљīćīėīńīāąėč!");
TogglePlayerControllable(playerid, 1);
}
else
{
gvote[4]--;
format(string, sizeof(string), "*** %s ļљīćīėīńīāąė ēą ''%s'', īńņąėīńь ćīėīńīā: %d", playername, Maps[4], gvote[4]);
SendClientMessageToAll(COLOR_LIGHTBLUE, string);
TogglePlayerControllable(playerid, 1);
PlayerVote[playerid]=1;
vote[4]++;
}
}
case 5:
{
if(PlayerVote[playerid]!=0)
{
format(string, sizeof(string), "***Ēą ''%s'' ļљīćīėīńīāąėī %d чеėīāеź", Maps[5], vote[5]);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
SendClientMessage(playerid, COLOR_LIGHTBLUE, "***Āū уęе ļљīćīėīńīāąėč!");
TogglePlayerControllable(playerid, 1);
}
else
{
gvote[5]--;
format(string, sizeof(string), "*** %s ļљīćīėīńīāąė ēą ''%s'', īńņąėīńь ćīėīńīā: %d", playername, Maps[5], gvote[5]);
SendClientMessageToAll(COLOR_LIGHTBLUE, string);
TogglePlayerControllable(playerid, 1);
PlayerVote[playerid]=1;
vote[5]++;
}
}
case 6:
{
if(PlayerVote[playerid]!=0)
{
format(string, sizeof(string), "***Ēą ''%s'' ļљīćīėīńīāąėī %d чеėīāеź", Maps[6], vote[6]);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
SendClientMessage(playerid, COLOR_LIGHTBLUE, "***Āū уęе ļљīćīėīńīāąėč!");
TogglePlayerControllable(playerid, 1);
}
else
{
gvote[6]--;
format(string, sizeof(string), "*** %s ļљīćīėīńīāąė ēą ''%s'', īńņąėīńь ćīėīńīā: %d", playername, Maps[6], gvote[6]);
SendClientMessageToAll(COLOR_LIGHTBLUE, string);
TogglePlayerControllable(playerid, 1);
PlayerVote[playerid]=1;
vote[6]++;
}
}
case 7:
{
if(PlayerVote[playerid]!=0)
{
format(string, sizeof(string), "***Ēą ''%s'' ļљīćīėīńīāąėī %d чеėīāеź", Maps[7], vote[7]);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
SendClientMessage(playerid, COLOR_LIGHTBLUE, "***Āū уęе ļљīćīėīńīāąėč!");
TogglePlayerControllable(playerid, 1);
}
else
{
gvote[7]--;
format(string, sizeof(string), "*** %s ļљīćīėīńīāąė ēą ''%s'', īńņąėīńь ćīėīńīā: %d", playername, Maps[7], gvote[7]);
SendClientMessageToAll(COLOR_LIGHTBLUE, string);
TogglePlayerControllable(playerid, 1);
PlayerVote[playerid]=1;
vote[7]++;
}
}
case 8:
{
if(PlayerVote[playerid]!=0)
{
format(string, sizeof(string), "***Ēą ''%s'' ļљīćīėīńīāąėī %d чеėīāеź", Maps[8], vote[8]);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
SendClientMessage(playerid, COLOR_LIGHTBLUE, "***Āū уęе ļљīćīėīńīāąėč!");
TogglePlayerControllable(playerid, 1);
}
else
{
gvote[8]--;
format(string, sizeof(string), "*** %s ļљīćīėīńīāąė ēą ''%s'', īńņąėīńь ćīėīńīā: %d", playername, Maps[8], gvote[8]);
SendClientMessageToAll(COLOR_LIGHTBLUE, string);
TogglePlayerControllable(playerid, 1);
PlayerVote[playerid]=1;
vote[8]++;
}
}
case 9:
{
if(PlayerVote[playerid]!=0)
{
format(string, sizeof(string), "***Ēą ''%s'' ļљīćīėīńīāąėī %d чеėīāеź", Maps[9], vote[9]);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
SendClientMessage(playerid, COLOR_LIGHTBLUE, "***Āū уęе ļљīćīėīńīāąėč!");
TogglePlayerControllable(playerid, 1);
}
else
{
gvote[9]--;
format(string, sizeof(string), "*** %s ļљīćīėīńīāąė ēą ''%s'', īńņąėīńь ćīėīńīā: %d", playername, Maps[9], gvote[9]);
SendClientMessageToAll(COLOR_LIGHTBLUE, string);
TogglePlayerControllable(playerid, 1);
PlayerVote[playerid]=1;
vote[9]++;
}
}
case 10:
{
if(PlayerVote[playerid]!=0)
{
format(string, sizeof(string), "***Ēą ''%s'' ļљīćīėīńīāąėī %d чеėīāеź", Maps[10], vote[10]);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
SendClientMessage(playerid, COLOR_LIGHTBLUE, "***Āū уęе ļљīćīėīńīāąėč!");
TogglePlayerControllable(playerid, 1);
}
else
{
gvote[10]--;
format(string, sizeof(string), "*** %s ļљīćīėīńīāąė ēą ''%s'', īńņąėīńь ćīėīńīā: %d", playername, Maps[10], gvote[10]);
SendClientMessageToAll(COLOR_LIGHTBLUE, string);
TogglePlayerControllable(playerid, 1);
PlayerVote[playerid]=1;
vote[10]++;
}
}
/*case 11:
{
if(PlayerVote[playerid]==12)
{
format(string, sizeof(string), "*** %s ļљīćīėīńīāąė ēą %s, īńņąėīńь ćīėīńīā: %d", playername, Maps[11], gvote[11]);
SendClientMessageToAll(COLOR_LIGHTBLUE, string);
TogglePlayerControllable(playerid, 1);
PlayerVote[playerid]=12;
}
else
{
gvote[11]--;
format(string, sizeof(string), "*** %s ļљīćīėīńīāąė ēą %s, īńņąėīńь ćīėīńīā: %d", playername, Maps[11], gvote[11]);
SendClientMessageToAll(COLOR_LIGHTBLUE, string);
TogglePlayerControllable(playerid, 1);
PlayerVote[playerid]=12;
vote[11]++;
}
}*/
}
}
return 1;
}
public OnPlayerExitedMenu(playerid)
{
TogglePlayerControllable(playerid, 1);
SendClientMessage(playerid,COLOR_LIGHTBLUE," Āūįīљ źąљņū дė˙ ćīėīńīāąķč˙ īņģеķшķ");
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(oldkeys==16384)//NUM6
{
if(PlayerSpectating[playerid] == 1)
{
pID++;
return 1;
}
}
else if(oldkeys==8192)//NUM4
{
if(PlayerSpectating[playerid] == 1)
{
pID--;
return 1;
}
}
return 0;
}
public ExitGameMode()
{
new string[256];
if(vote[0] == pVote)
{
vinVote=Maps[0];
format(string, sizeof(string), "~w~CMEHA ‚E†MMOA HA ~r~%s", vinVote);
GameTextForAll(string, 12000, 3);
ChangeMode();
}
if(vote[1] == pVote)
{
vinVote=Maps[1];
format(string, sizeof(string), "~w~CMEHA ‚E†MMOA HA ~r~%s", vinVote);
GameTextForAll(string, 12000, 3);
ChangeMode();
}
if(vote[2] == pVote)
{
vinVote=Maps[2];
format(string, sizeof(string), "~w~CMEHA ‚E†MMOA HA ~r~%s", vinVote);
GameTextForAll(string, 12000, 3);
ChangeMode();
}
if(vote[3] == pVote)
{
vinVote=Maps[3];
format(string, sizeof(string), "~w~CMEHA ‚E†MMOA HA ~r~%s", vinVote);
GameTextForAll(string, 12000, 3);
ChangeMode();
}
if(vote[4] == pVote)
{
vinVote=Maps[4];
format(string, sizeof(string), "~w~CMEHA ‚E†MMOA HA ~r~%s", vinVote);
GameTextForAll(string, 12000, 3);
ChangeMode();
}
if(vote[5] == pVote)
{
vinVote=Maps[5];
format(string, sizeof(string), "~w~CMEHA ‚E†MMOA HA ~r~%s", vinVote);
GameTextForAll(string, 12000, 3);
ChangeMode();
}
if(vote[6] == pVote)
{
vinVote=Maps[6];
format(string, sizeof(string), "~w~CMEHA ‚E†MMOA HA ~r~%s", vinVote);
GameTextForAll(string, 12000, 3);
ChangeMode();
}
if(vote[7] == pVote)
{
vinVote=Maps[7];
format(string, sizeof(string), "~w~CMEHA ‚E†MMOA HA ~r~%s", vinVote);
GameTextForAll(string, 12000, 3);
ChangeMode();
}
if(vote[8] == pVote)
{
vinVote=Maps[8];
format(string, sizeof(string), "~w~CMEHA ‚E†MMOA HA ~r~%s", vinVote);
GameTextForAll(string, 12000, 3);
ChangeMode();
}
if(vote[9] == pVote)
{
vinVote=Maps[9];
format(string, sizeof(string), "~w~CMEHA ‚E†MMOA HA ~r~%s", vinVote);
GameTextForAll(string, 12000, 3);
ChangeMode();
}
if(vote[10] == pVote)
{
vinVote=Maps[10];
format(string, sizeof(string), "~w~CMEHA ‚E†MMOA HA ~r~%s", vinVote);
GameTextForAll(string, 12000, 3);
ChangeMode();
}
if(vote[11] == pVote)
{
vinVote=Maps[11];
format(string, sizeof(string), "~w~CMEHA ‚E†MMOA HA ~r~%s", vinVote);
GameTextForAll(string, 12000, 3);
ChangeMode();
}
return 0;
}
public DMTimer()
{
DMTime --;
if (DMTime == 0.1)
{
new string[256];
format(string, sizeof(string), "~w~CMEHA ‚E†MMOA HA ~r~%s", Maps[rand]);
GameTextForAll(string, 12000, 3);
new string1[64];
format(string1,sizeof(string1), "changemode %s", Maps[rand]);
SendRconCommand(string1);
return 1;
}
return 0;
}
//**************************Чņеķčе ńņąņčńņčźč čćљīźīā**************************//
public OnPlayerReadStat(playerid)
{
new string2[32];
new playername[256];
new valtmp[128];
GetPlayerName(playerid,playername,sizeof(playername));
format(string2, sizeof(string2), "PlayersStat/%s.txt", playername);
//new File: file = fopen(string2, io_read);
if(fexist(string2))
{
new File: file = fopen(string2, io_read);
fread(file, valtmp);GetVal(valtmp);PlayerInfo[playerid][pKills] = RetVal;
fread(file, valtmp);GetVal(valtmp);PlayerInfo[playerid][pDeaths] = RetVal;
fread(file, valtmp);GetVal(valtmp);PlayerInfo[playerid][pScore] = RetVal;
fread(file, valtmp);GetVal(valtmp);PlayerInfo[playerid][pRatio] = RetVal;
fclose(file);
SendClientMessage(playerid,COLOR_WHITE,"*Āąųa ńņąņčńņčźą ēąćљуęеķą!");
SendClientMessage(playerid,COLOR_WHITE,"******************************************************************");
SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);
}
else
{
fcreate(string2);
SendClientMessage(playerid,COLOR_WHITE,"*Āąų ąźźąуķņ ńīēдąķ ąāņīģąņčчеńźč!");
SendClientMessage(playerid,COLOR_WHITE,"******************************************************************");
}
}
public GetVal(string[])
{
new tmp1[32];
new idx;
tmp1 = strtok(string, idx);
tmp1 = strtok(string, idx);
RetVal = strval(tmp1);
strmid(string, string, 0, strlen(string)-1, 255);
}
//**************************Īįķīāėеķčе ńņąņčńņčźč čćљīźą*****************************//
public OnPlayerUpdate(playerid)
{
new string3[32];
new playername[256];
new Float:ratio = floatdiv(PlayerInfo[playerid][pKills], PlayerInfo[playerid][pDeaths]);
GetPlayerName(playerid,playername,sizeof(playername));
PlayerInfo[playerid][pScore] = GetPlayerScore(playerid);
format(string3, sizeof(string3), "PlayersStat/%s.txt", playername);
new File: hFile = fopen(string3, io_write);
if(hFile)
{
new var[32];
format(var, 32, "Kills %d\r\n",PlayerInfo[playerid][pKills]);fwrite(hFile, var);
format(var, 32, "Deaths %d\r\n",PlayerInfo[playerid][pDeaths]);fwrite(hFile, var);
format(var, 32, "Score %d\r\n",PlayerInfo[playerid][pScore]);fwrite(hFile, var);
format(var, 32, "Ratio %.2f\r\n",ratio);fwrite(hFile, var);
fclose(hFile);
}
return 1;
}
//*************************Āūāīд ńņąņčńņčźč ģćљīźą*****************************//
public ShowStats(playerid)
{
new string[64];
new playername[256];
new Float:ratio=floatdiv(PlayerInfo[playerid][pKills], PlayerInfo[playerid][pDeaths]);
GetPlayerName(playerid,playername,sizeof(playername));
format(string, sizeof(string)," Ńņąņčńņčźą: %s",playername);
SendClientMessage(playerid, COLOR_LIGHTBLUE,string);
format(string, sizeof(string), " Уįčйńņā:[%d], Ńģељņей:[%d], Īчźč:[%d], Źīżōōčцčеķņ:[%.2f]",PlayerInfo[playerid][pKills],PlayerInfo[playerid][pDeaths],PlayerInfo[playerid][pScore],ratio);
SendClientMessage(playerid, COLOR_LIGHTBLUE,string);
}
public OnPlayerSpectat(playerid)
{
new string[256];
new pname[256];
for(new i = 0; i <= MAX_PLAYERS; i++)
{
if(PlayerSpectating[i] == 1)
{
if(IsPlayerConnected(pID))
{
GetPlayerName(pID,pname,sizeof(pname));
format(string,sizeof(string),"~n~~n~~n~~n~~n~~n~~n~~n~HAЂ‡”EH…E: ~r~%s(ID:%d)",pname,pID);
GameTextForPlayer(i, string,2000,5);
TogglePlayerSpectating(i, 1);
PlayerSpectatePlayer(i, pID);
}
else
{
if(pID==MAX_PLAYERS)
{
pID=0;
}
else
{
pID++;
}
}
}
}
return 1;
}
public ChangeMode()
{
new string[256];
format(string,sizeof(string), "changemode %s", vinVote);
SendRconCommand(string);
}
public fcreate(filename[])
{
if (fexist(filename)){return false;}
new File:fhandle = fopen(filename,io_write);
fclose(fhandle);
return true;
}
public UnsetVoting()
{
for(new i = 0; i <= MAX_PLAYERS; i++)
{
vote[i]=0;
gvote[i]=pVote;
PlayerVote[i]=0;
}
SendClientMessageToAll(COLOR_LIGHTBLUE, "***Љеēуėьņąņū ćīėīńīāąķč˙ ńįљīųеķū!");
}