02.07.2013, 01:38
PAWNO Compiler:
First Error:
For the first error, it says undefined symbol which has been defined.
Second Error:
I don't even knows what that means.
If someone could please tell me why I have errors, and how I can fix them, that'd be great!
Script:
pawn Код:
C:\Users\Owner\Desktop\SA-MP Server1\gamemodes\COD4.pwn(36) : error 017: undefined symbol "TEAM_USA"
C:\Users\Owner\Desktop\SA-MP Server1\gamemodes\COD4.pwn(41) : error 018: initialization data exceeds declared size
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
2 Errors.
For the first error, it says undefined symbol which has been defined.
pawn Код:
{103.7123,1805.2091,386.8307,2079.9294,TEAM_USA}
pawn Код:
#define TEAM_USA 0
pawn Код:
new Teams[] = {
TEAM_USA
};
I don't even knows what that means.
If someone could please tell me why I have errors, and how I can fix them, that'd be great!
Script:
pawn Код:
//--------------------------------------------------------------------//
//------------------[Call of Duty 4: Last Chance]---------------------//
//--------------------------------------------------------------------//
//----[Information]----//
// Script Start: 6/22/2013
// Script Mode: Team Death Match
//----[Credits]----//
// Script Owner(s): DJTunes, and JJB562
// Scripter(s): DJTunes, and JJB562
// Mapper(s): None
//----[Links]----//
// DJTunes's SA-MP Forum Profile: http://forum.sa-mp.com/member.php?u=187999
// JJB562's SA-MP Forum Profile: http://forum.sa-mp.com/member.php?u=134993
// DJTunes's Tutorials/Gamemodes/Filterscripts/Ect: https://docs.******.com/document/d/1q2zB...sp=sharing
// Call of Duty 4 Script Changelog: https://docs.******.com/document/d/1A8It...sp=sharing
//-----------------------------------//
//----[Includes]----//
#include <a_samp>
#include <zcmd>
#include <YSI\y_ini>
//-----------------------------------//
//---[Variables]---//
new Text:COD4DM;
//---[Enum]---//
enum eZone
{
Float:zMinX,
Float:zMinY,
Float:zMaxX,
Float:zMaxY,
zTeam
}
//---[Zones]---//
new ZoneInfo[][eZone] = {
{103.7123,1805.2091,386.8307,2079.9294,TEAM_USA}
};
new ZoneID[sizeof(ZoneInfo)];
//---[Capture Zones]---//
new ZoneAttacker[sizeof(ZoneInfo)] = {-1, ...};
new ZoneAttackTime[sizeof(ZoneInfo)];
//----[Random Messages]----//
new RandomMSG[][] =
{
"Having problems? Type /help for a list of server commands.", // Edit inside the '"'
"Like the script? Then say so by commenting on the release located on sa-mp forums.",
"Credits: DJTunes, and JJB562."
};
//----[Defines]----//
//----[Colors]----//
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_RED 0xFF0000
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_BLUE 0x0000BBAA
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_ORANGE 0xFF9900AA
#define COLOR_LIME 0x10F441AA
#define COLOR_MAGENTA 0xFF00FFFF
#define COLOR_NAVY 0x000080AA
#define COLOR_AQUA 0xF0F8FFAA
#define COLOR_CRIMSON 0xDC143CAA
#define COLOR_FLBLUE 0x6495EDAA
#define COLOR_BISQUE 0xFFE4C4AA
#define COLOR_BLACK 0x000000AA
#define COLOR_CHARTREUSE 0x7FFF00AA
#define COLOR_BROWN 0XA52A2AAA
#define COLOR_CORAL 0xFF7F50AA
#define COLOR_GOLD 0xB8860BAA
#define COLOR_GREENYELLOW 0xADFF2FAA
#define COLOR_INDIGO 0x4B00B0AA
#define COLOR_IVORY 0xFFFF82AA
#define COLOR_LAWNGREEN 0x7CFC00AA
#define COLOR_SEAGREEN 0x20B2AAAA
#define COLOR_LIMEGREEN 0x32CD32AA
#define COLOR_MIDNIGHTBLUE 0X191970AA
#define COLOR_MAROON 0x800000AA
#define COLOR_OLIVE 0x808000AA
#define COLOR_ORANGERED 0xFF4500AA
#define COLOR_PINK 0xFFC0CBAA
#define COLOR_SPRINGGREEN 0x00FF7FAA
#define COLOR_TOMATO 0xFF6347AA
#define COLOR_YELLOWGREEN 0x9ACD32AA
#define COLOR_MEDIUMAQUA 0x83BFBFAA
#define COLOR_MEDIUMMAGENTA 0x8B008BAA
#define COL_WHITE "{FFFFFF}"
#define COL_RED "{F81414}"
#define COL_GREEN "{00FF22}"
#define COL_LIGHTBLUE "{00CED1}"
//----[Login System]----//
#define DIALOG_REGISTER 1
#define DIALOG_LOGIN 2
#define DIALOG_SUCCESS_1 3
#define DIALOG_SUCCESS_2 4
#define PATH "/Users/%s.ini"
#define DIALOG_SVRRULES 5
//----[Teams]----//
#define TEAM_USA 0
#define TEAM_GERMANY 1
#define TEAM_UK 2
#define TEAM_FRANCE 3
#define TEAM_SOVIET 4
#define TEAM_IMPERIALS 5
#define TEAM_REBELS 6
#define TAKEOVER_TIME 60
#define MIN_MEMBERS_TO_START_WAR 1
//-----------------------------------//
//----[Variables]----//
new gTeam[MAX_PLAYERS];
SetPlayerTeamFromClass(playerid, classid)
{
if(classid == 0) gTeam[playerid] = TEAM_IMPERIALS;
else if(classid == 1) gTeam[playerid] = TEAM_GERMANY;
else if(classid == 2) gTeam[playerid] = TEAM_UK;
else if(classid == 3) gTeam[playerid] = TEAM_FRANCE;
else if(classid == 4) gTeam[playerid] = TEAM_SOVIET;
else if(classid == 5) gTeam[playerid] = TEAM_USA;
else if(classid == 6) gTeam[playerid] = TEAM_REBELS;
}
new Teams[] = {
TEAM_USA
};
//----[Login/Register System]----//
enum pInfo
{
pPass,
pCash,
pAdmin,
pKills,
pScore,
pDeaths
}
new PlayerInfo[MAX_PLAYERS][pInfo];
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
INI_Int("Password",PlayerInfo[playerid][pPass]);
INI_Int("Cash",PlayerInfo[playerid][pCash]);
INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
INI_Int("Kills",PlayerInfo[playerid][pKills]);
INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
INI_Int("Score",PlayerInfo[playerid][pScore]);
return 1;
}
//----[Print]----//
main()
{
print("\n----------------------------------");
print("Call of Duty 4: Last Chance loaded.");
print("Scripted by - DJTunes, and JJB562");
print("----------------------------------\n");
}
//----[Ranks]----//
forward Rank(playerid);
public Rank(playerid)
{
if (GetPlayerScore(playerid) >= 0 && GetPlayerScore(playerid) <= 100)
{
SendClientMessage(playerid, COLOR_RED,"You have came into battle as a Recruit - 1");
}
if (GetPlayerScore(playerid) >= 101 && GetPlayerScore(playerid) <=200)
{
SendClientMessage(playerid, COLOR_RED,"You have came into battle as a Soldier - 2");
}
if (GetPlayerScore(playerid) >= 201 && GetPlayerScore(playerid) <=300)
{
SendClientMessage(playerid, COLOR_RED,"You have came into battle as a Elite Soldier - 3");
}
if (GetPlayerScore(playerid) >= 301 && GetPlayerScore(playerid) <=400)
{
SendClientMessage(playerid, COLOR_RED,"You have came into battle as a Elite Captain - 4");
}
if (GetPlayerScore(playerid) >= 401 && GetPlayerScore(playerid) <=900)
{
SendClientMessage(playerid, COLOR_RED,"You have came into battle as a Elite Commander - 5");
}
if (GetPlayerScore(playerid) >= 901)
{
SendClientMessage(playerid, COLOR_RED,"You have came into battle as a General - 6");
}
}
//--------------------------------------------------------------------//
//------------------[Call of Duty 4: Commands]------------------------//
//--------------------------------------------------------------------//
CMD:forum(playerid, params[])
{
SendClientMessage(playerid, COLOR_GREEN, "www.sa-mp.com");
GameTextForPlayer(playerid, "~w~Server Website:~n~www.sa-mp.com", 2500, 3);
return 1;
}
CMD:rank(playerid, params[])
{
Rank(playerid);
return 1;
}
CMD:ranks(playerid, params[])
{
SendClientMessage(playerid, COLOR_RED,"==========================Ranks=====================");
SendClientMessage(playerid, COLOR_GREEN,"Recruit (000-100)");
SendClientMessage(playerid, COLOR_GREEN,"Soldier (101-200)");
SendClientMessage(playerid, COLOR_GREEN,"Elite Soldier (201-300)");
SendClientMessage(playerid, COLOR_GREEN,"Elite Captain (301-400)");
SendClientMessage(playerid, COLOR_GREEN,"Elite Commander (401-500)");
SendClientMessage(playerid, COLOR_GREEN,"General (501-600)");
SendClientMessage(playerid, COLOR_RED,"====================================================");
return 1;
}
CMD:rankbonus(playerid, params[])
{
SendClientMessage(playerid, COLOR_RED,"=====================Rank-Bonus===================");
SendClientMessage(playerid, COLOR_GREEN,"Recruit Bonus = 100 Health + 20 Armour");
SendClientMessage(playerid, COLOR_GREEN,"Soldier Bonus = 100 Health + 30 Armour");
SendClientMessage(playerid, COLOR_GREEN,"Elite Soldier Bonus = 100 Health + 40 Armour");
SendClientMessage(playerid, COLOR_GREEN,"Elite Captain Bonus = 100 Health + 60 Armour");
SendClientMessage(playerid, COLOR_GREEN,"Elite Commander Bonus = 100 Health + 80 Armour");
SendClientMessage(playerid, COLOR_GREEN,"General Bonus = 100 Health + 100 Armour");
SendClientMessage(playerid, COLOR_RED,"===================================================");
return 1;
}
CMD:help(playerid, params[])
{
SendClientMessage(playerid, COLOR_RED,"=====================Help===================");
SendClientMessage(playerid, COLOR_GREEN,"[Rank Help] /rank, /rankbonus, /ranks");
SendClientMessage(playerid, COLOR_GREEN,"[General Help] /kill, /help, /forum");
SendClientMessage(playerid, COLOR_GREEN,"[Team Help] /changeteam");
SendClientMessage(playerid, COLOR_RED,"============================================");
return 1;
}
CMD:kill(playerid)
{
SetPlayerHealth(playerid,0.0);
return 1;
}
CMD:changeteam(playerid, params[])
{
SetPlayerHealth(playerid, 0.0);
ForceClassSelection(playerid);
SendClientMessage(playerid, -1,"Select your new Team!");
return 1;
}
//--------------------------------------------------------------------//
//------------------[Call of Duty 4: Gamemode]------------------------//
//--------------------------------------------------------------------//
public OnPlayerDisconnect(playerid, reason)
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
INI_WriteInt(File,"Score",GetPlayerScore(playerid));
INI_Close(File);
//----[Leave Messages]----//
new pname[MAX_PLAYER_NAME], string[39 + MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
switch(reason)
{
case 0: format(string, sizeof(string), "%s has left the server. (Lost Connection)", pname);
case 1: format(string, sizeof(string), "%s has left the server. (Leaving)", pname);
case 2: format(string, sizeof(string), "%s has left the server. (Kicked)", pname);
}
SendClientMessageToAll(0xAAAAAAAA, string);
return 1;
}
//---------------------------
public OnPlayerSpawn(playerid)
{
for(new i=0; i < sizeof(ZoneInfo); i++)
{
GangZoneShowForPlayer(playerid, ZoneID[i], GetTeamZoneColor(ZoneInfo[i][zTeam]));
if(ZoneAttacker[i] != -1) GangZoneFlashForPlayer(playerid, ZoneID[i], GetTeamZoneColor(ZoneAttacker[i]));
}
for(new i=0; i < sizeof(ZoneInfo); i++)
{
GangZoneShowForPlayer(playerid, ZoneID[i], GetTeamZoneColor(ZoneInfo[i][zTeam]));
}
ForceClassSelection(playerid);
//----[Team System]----//
if(gTeam[playerid] == TEAM_IMPERIALS)
{
SetPlayerColor(playerid, COLOR_YELLOW);
SetPlayerPos(playerid, 2540.2231, 2822.2043, 10.8203);
SetPlayerInterior(playerid,0);
SetPlayerVirtualWorld(playerid, 0);
SetCameraBehindPlayer(playerid);
TogglePlayerControllable(playerid, true);
}
else if(gTeam[playerid] == TEAM_GERMANY)
{
SetPlayerColor(playerid, COLOR_GREEN);
SetPlayerPos(playerid, -1347.3311, 492.1618, 18.2344);
SetPlayerInterior(playerid,0);
SetPlayerVirtualWorld(playerid, 0);
SetCameraBehindPlayer(playerid);
TogglePlayerControllable(playerid, true);
}
else if(gTeam[playerid] == TEAM_UK)
{
SetPlayerColor(playerid, COLOR_BLUE);
SetPlayerPos(playerid, -250.6950, 2600.0293, 62.8582);
SetPlayerInterior(playerid,0);
SetPlayerVirtualWorld(playerid, 0);
SetCameraBehindPlayer(playerid);
TogglePlayerControllable(playerid, true);
}
else if(gTeam[playerid] == TEAM_FRANCE)
{
SetPlayerColor(playerid, COLOR_ORANGE);
SetPlayerPos(playerid, -329.1653, 1537.0428, 76.6117);
SetPlayerInterior(playerid,0);
SetPlayerVirtualWorld(playerid, 0);
SetCameraBehindPlayer(playerid);
TogglePlayerControllable(playerid, true);
}
else if(gTeam[playerid] == TEAM_SOVIET)
{
SetPlayerColor(playerid, COLOR_RED);
SetPlayerPos(playerid, 415.2696, 2537.1301, 19.1484);
SetPlayerInterior(playerid,0);
SetPlayerVirtualWorld(playerid, 0);
SetCameraBehindPlayer(playerid);
TogglePlayerControllable(playerid, true);
}
else if(gTeam[playerid] == TEAM_USA)
{
SetPlayerColor(playerid, COLOR_WHITE);
SetPlayerPos(playerid, 203.1575, 1869.2867, 13.1406);
SetPlayerInterior(playerid,0);
SetPlayerVirtualWorld(playerid, 0);
SetCameraBehindPlayer(playerid);
TogglePlayerControllable(playerid, true);
}
else if(gTeam[playerid] == TEAM_REBELS)
{
SetPlayerColor(playerid, COLOR_RED);
SetPlayerPos(playerid, 244.9354, 1408.4061, 10.7075);
SetPlayerInterior(playerid,0);
SetPlayerVirtualWorld(playerid, 0);
SetCameraBehindPlayer(playerid);
TogglePlayerControllable(playerid, true);
}
//----[Spawn System (Health + Armor Check)----//
if (GetPlayerScore(playerid) >= 0 && GetPlayerScore(playerid) <= 100)
{
SendClientMessage(playerid, COLOR_RED,"Health Check: {FFFFFF}Armour: 20% | {FF0000}Health: 100%");
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 20);
}
if (GetPlayerScore(playerid) >= 101 && GetPlayerScore(playerid) <=200)
{
SendClientMessage(playerid, COLOR_RED,"Health Check: {FFFFFF}Armour: 30% | {FF0000}Health: 100%");
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 30);
}
if (GetPlayerScore(playerid) >= 201 && GetPlayerScore(playerid) <=300)
{
SendClientMessage(playerid, COLOR_RED,"Health Check: {FFFFFF}Armour: 40% | {FF0000}Health: 100%");
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 40);
}
if (GetPlayerScore(playerid) >= 301 && GetPlayerScore(playerid) <=400)
{
SendClientMessage(playerid, COLOR_RED,"Health Check: {FFFFFF}Armour: 60% | {FF0000}Health: 100%");
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 60);
}
if (GetPlayerScore(playerid) >= 401 && GetPlayerScore(playerid) <=900)
{
SendClientMessage(playerid, COLOR_RED,"Health Check: {FFFFFF}Armour: 80% | {FF0000}Health: 100%");
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 80);
}
if (GetPlayerScore(playerid) >= 901)
{
SendClientMessage(playerid, COLOR_RED,"Health Check: {FFFFFF}Armour: 100% | {FF0000}Health: 100%");
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 100);
}
return 1;
}
public OnPlayerConnect(playerid)
{
if(fexist(UserPath(playerid)))
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"Type your password below to login.","Login","Quit");
}
else
{
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""COL_WHITE"Type your password below to register a new account.","Register","Quit");
}
new string[78], pnome[MAX_PLAYER_NAME];
GetPlayerName(playerid, pnome, sizeof(pnome));
format(string, sizeof(string), "{1E90FF}%s {006400}(ID:%d) {B22222}Connected to Call of Duty 4: Last Chance.", pnome, playerid);
SendClientMessageToAll(-1, string);
TextDrawShowForPlayer(playerid, COD4DM);
PlayAudioStreamForPlayer(playerid, "http://videogamers.eu/public/product/Modern%20Warfare%203%20(PC)%20mixtape%20by%20Ramiires.mp3");
//----[Agreement System]-----------//
//ShowPlayerDialog(playerid, DIALOG_SVRRULES, DIALOG_STYLE_MSGBOX, "Server Rules", "You must agree with these rules.\n1. Do not team kill\n2. Do not base rape\n3. Do not spawn kill\n4. You will respect all users\n5. You will not use any kind of hack\n6. You will not advertise anything on our server\n7. You will follow these rules, and if not get banned.", "Close", "");
//---------------------------------//
SendClientMessage(playerid, COLOR_GREEN, "Welcome to Call of Duty 4: Last Chance... Stand by for depature.");
SendClientMessage(playerid, COLOR_GREEN, "Make sure no of them gets out of this alive.");
SendClientMessage(playerid, COLOR_GREEN, "Depature complete, you're clear to engage.");
SendClientMessage(playerid, COLOR_GREEN, "This script is released on SA-MP forums by DJTunes.");
return 1;
}
public OnGameModeInit()
{
for(new i=0; i < sizeof(ZoneInfo); i++)
{
ZoneID[i] = GangZoneCreate(ZoneInfo[i][zMinX], ZoneInfo[i][zMinY], ZoneInfo[i][zMaxX], ZoneInfo[i][zMaxY]);
}
SetGameModeText("COD4");
SendRconCommand("mapname San Andreas");
UsePlayerPedAnims();
//----[Timers]----//
SetTimer("SendMSG", 60000, true);
SetTimer("ZoneTimer", 1000, true);
//-------------------------------//
//----[Teams]----//
AddPlayerClass(282,2540.2231,2822.2043,10.8203,256.3714,0,0,0,0,0,0); // Imperials 0
AddPlayerClass(111,-1347.3311,492.1618,18.2344,2.5182,0,0,0,0,0,0); // Germany 1
AddPlayerClass(285,-250.6950,2600.0293,62.8582,94.9302,0,0,0,0,0,0); // United Kingdom 2
AddPlayerClass(250,-329.1653,1537.0428,76.6117,80.1225,0,0,0,0,0,0); // France 3
AddPlayerClass(121,415.2696,2537.1301,19.1484,267.7282,0,0,0,0,0,0); // Soviets 4
AddPlayerClass(287,203.1575,1869.2867,13.1406,63.4316,0,0,0,0,0,0); // United States 5
AddPlayerClass(179,244.9354,1408.4061,10.7075,92.0684,0,0,0,0,0,0); // Rebels 6
//-------------------------------//
COD4DM= TextDrawCreate(1.0, 433.0, "Call of Duty 4: Last Chance");
TextDrawAlignment(COD4DM,0);
TextDrawBackgroundColor(COD4DM,0x000000ff);
TextDrawFont(COD4DM,2);
TextDrawLetterSize(COD4DM,0.2999, 1.4);
TextDrawBoxColor(COD4DM,0x00000050);
TextDrawColor(COD4DM,0xffffffff);
TextDrawSetOutline(COD4DM,1);
TextDrawSetProportional(COD4DM,1);
TextDrawSetShadow(COD4DM,1);
for(new i; i < MAX_PLAYERS; i ++)
{
if(IsPlayerConnected(i))
{
TextDrawShowForPlayer(i, COD4DM);
}
}
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerTeamFromClass(playerid, classid);
SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraPos(playerid, 1958.3783 + (5 * floatsin(-89.6528, degrees)), 1343.1572 + (5 * floatcos(-89.6528, degrees)), 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerInterior(playerid, 0);
if(classid == 0) // Imperials
{
GameTextForPlayer(playerid, "~y~Imperials", 3000, 3);
}
else if(classid == 1) // Germany
{
GameTextForPlayer(playerid, "~g~Germany", 3000, 3);
}
else if(classid == 2) // United Kingdom (UK)
{
GameTextForPlayer(playerid, "~b~United Kingdom", 3000, 3);
}
else if(classid == 3) // France
{
GameTextForPlayer(playerid, "~y~France", 3000, 3);
}
else if(classid == 4) // Soviets
{
GameTextForPlayer(playerid, "~r~Soviet", 3000, 3);
}
else if(classid == 5) // United States (USA)
{
GameTextForPlayer(playerid, "~w~United States", 3000, 3);
}
else if(classid == 6) // Rebels
{
GameTextForPlayer(playerid, "~r~Rebels", 3000, 3);
}
return 1;
}
public OnGameModeExit()
{
TextDrawHideForAll(COD4DM);
TextDrawDestroy(COD4DM);
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
PlayerInfo[killerid][pKills]++; // Saves player(s) kills.
PlayerInfo[playerid][pDeaths]++; // Saves player(s) deaths.
PlayerInfo[killerid][pScore]+= 10; // Saves player(s) score.
GivePlayerMoney(killerid, 100); // Gives player(s) that killed another player, $100.
GivePlayerMoney(playerid, -50); // Takes away any player(s) that die.
SendDeathMessage(killerid, playerid, reason);
SendClientMessage(playerid, 0xAAAAAAAA, "You have been killed, and have lost 50$ for death.");
GameTextForPlayer(playerid, "~r~Killed!",2500,3);
SendClientMessage(killerid, 0xAAAAAAAA, "You killed a enemy soldier, and have been awarded 100$, and 10 score.");
SetPlayerWantedLevel(killerid, 6);
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch( dialogid )
{
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteInt(File,"Cash",0);
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"Kills",0);
INI_WriteInt(File,"Deaths",0);
INI_WriteInt(File,"Score",0);
INI_Close(File);
ForceClassSelection(playerid);
//ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have been registered. Please continue!","Ok","");
ShowPlayerDialog(playerid, DIALOG_SVRRULES, DIALOG_STYLE_MSGBOX, "Server Rules", "You must agree with these rules.\n1. Do not team kill\n2. Do not base rape\n3. Do not spawn kill\n4. You will respect all users\n5. You will not use any kind of hack\n6. You will not advertise anything on our server\n7. You will follow these rules, and if not get banned.", "Close", "");
}
}
case DIALOG_LOGIN:
{
if ( !response ) return Kick ( playerid );
if( response )
{
if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in!","Ok","");
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
}
return 1;
}
}
case DIALOG_SUCCESS_2:
{
if(!response) return 0;
if(response)
{
ShowPlayerDialog(playerid, DIALOG_SVRRULES, DIALOG_STYLE_MSGBOX, "Server Rules", "You must agree with these rules.\n1. Do not team kill\n2. Do not base rape\n3. Do not spawn kill\n4. You will respect all users\n5. You will not use any kind of hack\n6. You will not advertise anything on our server\n7. You will follow these rules, and if not get banned.", "Close", "");
}
}
}
return 1;
}
//----------------------------------------------------------------------------------------//
//----------------------------------------Fowards-----------------------------------------//
//----------------------------------------------------------------------------------------//
forward SendMSG();
//----[Random Messages]----//
public SendMSG()
{
new randMSG = random(sizeof(RandomMSG));
SendClientMessageToAll(COLOR_WHITE, RandomMSG[randMSG]);
}
forward ZoneTimer();
public ZoneTimer()
{
for(new i=0; i < sizeof(ZoneInfo); i++)
{
if(ZoneAttacker[i] != -1)
{
if(GetPlayersInZone(i, ZoneAttacker[i]) >= MIN_MEMBERS_TO_START_WAR)
{
ZoneAttackTime[i]++;
if(ZoneAttackTime[i] == TAKEOVER_TIME)
{
GangZoneStopFlashForAll(ZoneID[i]);
ZoneInfo[i][zTeam] = ZoneAttacker[i];
GangZoneShowForAll(ZoneID[i], GetTeamZoneColor(ZoneInfo[i][zTeam]));
ZoneAttacker[i] = -1;
}
}
else
{
GangZoneStopFlashForAll(ZoneID[i]);
ZoneAttacker[i] = -1;
}
}
else
{
for(new t=0; t < sizeof(Teams); t++)
{
if(Teams[t] != ZoneInfo[i][zTeam] && GetPlayersInZone(i, Teams[t]) >= MIN_MEMBERS_TO_START_WAR)
{
ZoneAttacker[i] = Teams[t];
ZoneAttackTime[i] = 0;
GangZoneFlashForAll(ZoneID[i], GetTeamZoneColor(ZoneAttacker[i]));
}
}
}
}
}
//----------------------------------------------------------------------------------------//
//----[Stocks]----//
stock UserPath(playerid)
{
new string[128],playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
format(string,sizeof(string),PATH,playername);
return string;
}
stock udb_hash(buf[]) {
new length=strlen(buf);
new s1 = 1;
new s2 = 0;
new n;
for (n=0; n<length; n++)
{
s1 = (s1 + buf[n]) % 65521;
s2 = (s2 + s1) % 65521;
}
return (s2 << 16) + s1;
}
stock GetTeamZoneColor(teamid)
{
switch(teamid)
{
case TEAM_USA: return 0xFFFFFF55;
}
return -1;
}
stock IsPlayerInZone(playerid, zoneid)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
return (x > ZoneInfo[zoneid][zMinX] && x < ZoneInfo[zoneid][zMaxX] && y > ZoneInfo[zoneid][zMinY] && y < ZoneInfo[zoneid][zMaxY]);
}
stock GetPlayersInZone(zoneid, teamid)
{
new count;
for(new i=0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && GetPlayerTeam(i) == teamid && IsPlayerInZone(i, zoneid))
{
count++;
}
}
return count;
}