08.09.2016, 04:30
I get this error when compiling the DM script
This is the whole script.
Code:
C:\Users\harvey\Desktop\Server\filterscripts\Untitled.pwn(479) : error 021: symbol already defined: "OnPlayerTakeDamage" Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 1 Error.
Code:
//include
#include <a_samp>
#include <dini>
#include <dudb>
#include <zcmd>
#include <sscanf>
//-----------------------------
#pragma unused ret_memcpy
//---------------------------------
//define
#define SERVER_GM_TEXT "D-GangWars v.001"
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_ORANGE 0xFF9900AA
#define COLOR_RED 0xAA3333AA
#define COLOR_YELLOW 0xFFFF00AA
//------------------------
//teams
#define TEAM_GROVE 1
#define TEAM_Crips 2
#define TEAM_LOS_SANTOS_VAGOS 3
#define TEAM_VARIOS_LOS_AZTECAS 4
#define TEAM_LSPD 5
#define TEAM_ANARCHIST 6
#define TEAM_HOBO 7
//---------------------------
#define SERVER_USER_FILE "users/%s.ini"
#define TEAM_GROVE_COLOR 0x00FF00AA // Bright Green
#define TEAM_BALLA_COLOR 0xFF00FFAA // Bright Purple
#define TEAM_LOS_SANTOS_VAGOS_COLOR 0xAFAFAFAA // Grey
#define TEAM_VARIOS_LOS_AZTECAS_COLOR 0x33CCFFAA // Light Blue
#define TEAM_HOBO_COLOR 0x993300AA // Brown
//-------------------------
// - bones
#define BODY_PART_TORSO (3)
#define BODY_PART_GROIN (4)
#define BODY_PART_LEFT_ARM (5)
#define BODY_PART_RIGHT_ARM (6)
#define BODY_PART_LEFT_LEG (7)
#define BODY_PART_RIGHT_LEG (8)
#define BODY_PART_HEAD (9)
enum pData
{
pAdminLevel,
pCash,
pScore,
pBan
}
new PlayerData[MAX_PLAYERS][pData];
new levels,Nam[MAX_PLAYER_NAME],pname[MAX_PLAYER_NAME],str[128],ID;
//------
new gPlayerLogged[MAX_PLAYERS];
new gTeam[MAX_PLAYERS];
new gPlayerClass[MAX_PLAYERS];
//-----
enum TeamCars
{
Bloods,
LSPD,
Hobo,
Crips,
ANARCHIST,
Cops,
AZTECAS
}
new Cars[TeamCars];
//forwards
forward SetupPlayerForClassSelection(playerid);
forward OnPlayerHeadShot(playerid, issuerid, Float:amount);
forward OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart);
forward OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid);
forward OnPlayerWeaponShot( playerid, weaponid, hittype, hitid, Float: fX, Float: fY, Float: fZ );
public OnPlayerConnect(playerid)
{
SendClientMessage(playerid, COLOR_ORANGE,"====================[Welcome]==================");
SendClientMessage(playerid, COLOR_GREY,"Welcome to Los Santos Team Deathmatch.");
// SendClientMessage(playerid, COLOR_GREY,"Use you command for help and your command to see the rules.");
SendClientMessage(playerid, COLOR_ORANGE,"================================================");
gPlayerLogged[playerid] = 0;
new name[MAX_PLAYER_NAME], file[256];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), SERVER_USER_FILE, name);
if (!dini_Exists(file))
{
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Hi you're not registered", "Welcome, You are not registered in our database, enter your password below", "Register", "Leave");
}
if(fexist(file))
{
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "You are registered", "Enter your password below", "Login", "Leave");
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
new name[MAX_PLAYER_NAME], file[256];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), SERVER_USER_FILE, name);
if(gPlayerLogged[playerid] == 1)
{
dini_IntSet(file, "Score", PlayerData[playerid][pScore]);
dini_IntSet(file, "Money", PlayerData[playerid][pCash]);
dini_IntSet(file, "AdminLevel",PlayerData[playerid][pAdminLevel]);
dini_IntSet(file, "Banned", PlayerData[playerid][pBan]);
}
gPlayerLogged[playerid] = 0;
return 1;
}
public OnGameModeInit()
{
SetGameModeText ("LS-TDM Rev 3.1");
SetTeamCount(2);
Cars[Bloods]= AddPlayerClass(19, 2494.5767,-1686.1864,13.5129,355.7687,0,0,0,0,0,0); // Bloods
Cars[Bloods]= AddStaticVehicle(566,2504.6165,-1682.2120,13.1676,11.5484,3,3); //bloodscar0
Cars[Bloods]= AddStaticVehicle(566,2508.5613,-1679.7991,13.3848,10.1013,3,3); // bloodscar1
Cars[Bloods]= AddStaticVehicle(560,2499.1650,-1683.3696,13.0231,11.1869,3,3); // bloodscar2
Cars[Bloods]= AddStaticVehicle(560,2491.1704,-1682.9939,13.2519,3.8113,3,3); // bloodscar3
Cars[Bloods]= AddStaticVehicle(536,2486.7319,-1683.1348,13.2257,6.0132,3,3); // bloodscar4
Cars[Bloods]= AddStaticVehicle(536,2512.3042,-1676.9368,13.1989,11.6676,3,3); // bloodscar5
Cars[Bloods]= AddStaticVehicle(475,2483.3882,-1682.8966,13.0427,1.4005,3,3); // bloodscar6
Cars[Bloods]= AddStaticVehicle(468,2513.1646,-1670.0023,13.0755,102.7341,3,3); // bloodsbike1
Cars[Bloods]= AddStaticVehicle(468,2512.9490,-1666.9865,13.1306,91.7290,3,3); // bloodsbike2
Cars[Bloods]= AddStaticVehicle(468,2512.5134,-1663.8923,13.1505,90.4309,3,3); // bloodsbike3
Cars[Crips]= AddPlayerClass(143, 1999.8833,-1120.6167,26.7746,181.6846,0,0,0,0,0,0); //Crips
Cars[Crips]= AddStaticVehicle(566,1948.2378,-1131.5389,25.4572,90.2552,79,79); // cripscar0
Cars[Crips]= AddStaticVehicle(566,1941.4482,-1131.4258,25.2050,90.5242,79,79); // cripscar1
Cars[Crips]= AddStaticVehicle(560,1934.8057,-1131.4783,24.9225,91.1032,79,79); // cripscar2
Cars[Crips]= AddStaticVehicle(560,1927.4950,-1131.5046,24.7885,90.1411,79,79); // cripscar3
Cars[Crips]= AddStaticVehicle(536,1921.0233,-1131.7767,24.6739,90.1544,79,79); // cripscar4
Cars[Crips]= AddStaticVehicle(536,1944.6661,-1143.2561,25.1773,353.6760,79,79); // cripsbike1
Cars[Crips]= AddStaticVehicle(471,1937.8147,-1143.0463,24.9998,359.4231,79,79); // cripsbike2
Cars[Crips]= AddStaticVehicle(471,1941.4227,-1143.1160,25.0893,2.3917,79,79); // cripsbike3
Cars[AZTECAS]= AddPlayerClass(116,2522.2378,-2000.4359,13.5469,128.5352,0,0,0,0,0,0); //Aztecas
Cars[AZTECAS]= AddStaticVehicle(566,1844.2039,-1927.9865,13.1998,89.6847,116,116); // aztecascar0
Cars[AZTECAS]= AddStaticVehicle(566,1837.5275,-1928.0200,13.1228,89.8919,116,116); // aztecascar1
Cars[AZTECAS]= AddStaticVehicle(560,1851.5607,-1928.0968,13.1904,90.1852,116,116); // aztecascar2
Cars[AZTECAS]= AddStaticVehicle(536,1857.9548,-1927.9910,13.0882,89.1671,116,116); // aztecascar3
Cars[AZTECAS]= AddStaticVehicle(536,1864.5150,-1927.9908,13.1197,89.4659,116,116); // aztecascar4
Cars[AZTECAS]= AddStaticVehicle(468,1845.3577,-1939.6879,13.0989,358.2544,116,116); // aztecasbike1
Cars[AZTECAS]= AddStaticVehicle(468,1848.4471,-1939.7332,13.1173,358.5280,116,116); // aztecasbike2
Cars[AZTECAS]= AddStaticVehicle(468,1852.2606,-1939.7489,13.1123,0.9635,116,116); // aztecasbike3
Cars[LSPD]= AddPlayerClass(265,1550.6207,-1675.7418,15.4894,86.4241,0,0,0,0,0,0); //Tenpenny
Cars[LSPD]= AddStaticVehicle(427,1534.0969,-1686.4365,13.5910,179.3800,0,1); // LSPDTRUCK1
Cars[LSPD]= AddStaticVehicle(596,1533.9149,-1661.6329,13.1821,179.4230,0,1); // LSPDCAR1
Cars[LSPD]= AddStaticVehicle(596,1533.9535,-1648.1016,13.1825,181.0566,0,1); // LSPDCAR2
Cars[LSPD]= AddStaticVehicle(596,1534.2207,-1638.7291,13.1814,178.9015,0,1); // LSPDCAR3
Cars[LSPD]= AddStaticVehicle(523,1542.1992,-1683.5516,13.1198,93.8415,0,0); // LSPDBIKE1
Cars[LSPD]= AddStaticVehicle(523,1542.2690,-1667.6261,13.1238,90.6924,0,0); // LSPDBIKE2
Cars[ANARCHIST]= AddPlayerClass(247,1304.3652,-1091.9817,25.7654,177.3955,0,0,0,0,0,0);//biker
Cars[ANARCHIST]= AddStaticVehicle(566,1297.8812,-1099.4774,25.6601,180.3320,7,121); // bikerCAR1
Cars[ANARCHIST]= AddStaticVehicle(560,1301.1383,-1100.0808,25.7716,182.8269,0,74); // bikerCAR2
Cars[ANARCHIST]= AddStaticVehicle(463,1306.7966,-1100.1927,25.2962,184.3666,6,25); // bikerBIKE1
Cars[ANARCHIST]= AddStaticVehicle(463,1304.4956,-1099.9102,25.3941,181.8885,45,60); // bikerBIKE2
Cars[ANARCHIST]= AddStaticVehicle(445,1314.0208,-1100.9015,25.5036,177.5006,47,21); // bikerCAR4
Cars[Hobo]= AddPlayerClass(137,2536.4011,-2049.3030,13.5500,85.0934,0,0,0,0,0,0); //Hobo
Cars[Hobo]= AddStaticVehicle(604,2536.8438,-2056.4309,13.5500,358.9964,1,1); //HOBOCAR
Cars[Hobo]= AddStaticVehicle(462,2545.8027,-2050.4395,13.5500,91.1173,1,1); //HOBOCAR1
Cars[Hobo]= AddStaticVehicle(462,2545.1934,-2048.0740,13.5500,98.6374,1,1); //HOBOCAR2
Cars[Hobo]= AddStaticVehicle(605,2537.3225,-2041.9825,13.5500,186.0816,1,1); //HOBOCAR3
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerClass(playerid, classid);
SetupPlayerForClassSelection(playerid);
gPlayerClass[playerid] = classid;
switch (classid)
{
case 0:
{
GameTextForPlayer(playerid, "~r~Bloods", 500, 6);
SetPlayerColor(playerid,COLOR_RED);
}
case 1:
{
GameTextForPlayer(playerid, "~b~Crips", 500, 6);
SetPlayerColor(playerid,0xFF00FFAA); // 0xFF00FFAA
}
case 2:
{
GameTextForPlayer(playerid,"~b~~h~~h~Aztecas",500,6);
}
case 3:
{
GameTextForPlayer(playerid,"LSPD",500,6);
}
case 4:
{
GameTextForPlayer(playerid,"~r~Bikers",500,6);
}
case 5:
{
GameTextForPlayer(playerid,"~y~Hobo",500,6);
}
}
return 1;
}
SetPlayerClass(playerid, classid)
{
switch(classid)
{
case 0..3: gTeam[playerid] = TEAM_GROVE;
case 4..6: gTeam[playerid] = TEAM_Crips;
case 7..9: gTeam[playerid] = TEAM_LOS_SANTOS_VAGOS;
case 10..13: gTeam[playerid] = TEAM_VARIOS_LOS_AZTECAS;
case 14..16: gTeam[playerid] = TEAM_LSPD;
case 17..19: gTeam[playerid] = TEAM_ANARCHIST;
case 20..23: gTeam[playerid] = TEAM_HOBO;
}
return 1;
}
public OnPlayerRequestSpawn(playerid)
{
SetupPlayerForClassSelection(playerid);
return 1;
}
public SetupPlayerForClassSelection(playerid)
{
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,1969.6920,-1199.5493,25.2605);
SetPlayerCameraPos(playerid,1971.6920,-1205.5493,26.2605);
SetPlayerCameraLookAt(playerid,1969.6920,-1199.5493,25.2605);
ApplyAnimation(playerid,"GANGS","prtial_gngtlkB",4.1,0,0,0,0,0);
}
//admin commands
CMD:makeadmin(playerid, params[])
{
if(!IsPlayerAdmin(playerid))return 0; //This command only works for rcon
if(sscanf(params,"ui",ID,levels)) return SendClientMessage(playerid,0xFF9900AA, "USAGE: /setadmin [ID] [Level 1-6]");//it will show this if you dont use the format properly
if(levels > 6) return SendClientMessage(playerid,0xFF0000FF,"LEVELS AVAILABLE 1-6!");//Available levels
if(!IsPlayerConnected(ID))return SendClientMessage(playerid,COLOR_GREY,"That user is not connected.");//Detect if the id/partofname is connected
if(PlayerData[ID][pAdminLevel] == levels) return SendClientMessage(playerid,0xFF0000FF, "ERROR: That person is already this admin level!");//Detect if the guy is already the level you setted
GetPlayerName(playerid,Nam, MAX_PLAYER_NAME);//define the playerid name
GetPlayerName(ID,pname,MAX_PLAYER_NAME);//define the other person name
if(levels == 0)
{
format(str, sizeof(str),"%s has your Admin level to %d on the server.",Nam,levels);
SendClientMessage(ID,0xFF9900AA,str);
format(str, sizeof(str),"You had set %s Admin level to %d!",pname,levels);
SendClientMessage(playerid,0xFF9900AA,str);
PlayerData[ID][pAdminLevel] = levels;//this sets the player level
return 1;
}
format(str, sizeof(str),"%s has your Admin level to %d on the server.",Nam,levels);
SendClientMessage(ID,0xFF9900AA,str);
format(str, sizeof(str),"You had set %s Admin level to %d!",pname,levels);
SendClientMessage(playerid,0xFF9900AA,str);
PlayerData[ID][pAdminLevel] = levels;
return 1;
}
CMD:apm(playerid, params[])
{
new str2[128], id;
if(PlayerData[playerid][pAdminLevel] < 1) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
if(sscanf(params, "us[128]", id, str2)) return SendClientMessage(playerid, COLOR_GREY, "Usage: /apm [ID] [MESSAGE]");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_GREY, "ERROR: Player Isnt Connected");
if(playerid == id) return SendClientMessage(playerid, COLOR_GREY, "You can't send your self a message");
new Name1[MAX_PLAYER_NAME], Name2[MAX_PLAYER_NAME], string[256];
GetPlayerName(playerid, Name1, sizeof(Name1));
GetPlayerName(id, Name2, sizeof(Name2));
format(str, sizeof(str), "%s has APMed %s: %s", Name1, Name2, str2);
SendClientMessage(playerid,COLOR_ORANGE, string);
format(str, sizeof(str), "Admin: %s", str2);
SendClientMessage(id, COLOR_RED, str);
return 1;
}
CMD:kill(playerid, params[])
{
SetPlayerHealth(playerid,0);
SendClientMessage(playerid, COLOR_RED, "You have killed yourself.");
return 1;
}
CMD:veh(playerid, params[])
{
if(PlayerData[playerid][pAdminLevel] < 1) return SendClientMessage(playerid, COLOR_RED, " ** You must be a level 1 Admin to use that! ");
if(isnull(params)) return SendClientMessage(playerid, COLOR_RED, "Use /veh [vehicle id]");
if(strval(params) < 400 || strval(params) > 611) return SendClientMessage(playerid, COLOR_RED, "Invalid vehicle model.");
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
CreateVehicle(strval(params), x+2, y+2, z, 90.0, 0, 0, 0);
return 1;
}
/*CMD:me(playerid, params[])
{
new str2[128];
new Name1[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name1, sizeof(Name1));
if(sscanf(params, "us[128]", str2)) return SendClientMessage(playerid, COLOR_GREY, "Usage: /me [action]");
GetPlayerName(playerid, str, sizeof(str));
format(str, sizeof(str), "* %s %s", Name1, str2);
SendClientMessageToAll(0xFFFF00AA, str2);
return 1;
}*/
CMD:me(playerid, params[])
{
if(isnull(params)) return SendClientMessage(playerid, 0xFFFFFFFF, "/me [text]");
new
string[128],
pName[28 char]
;
GetPlayerName(playerid, pName, sizeof(pName));
format(string, sizeof(string), "* %s %s *", pName, params);
return SendClientMessageToAll(0xFFFFFFFF, string);
}
CMD:vehdestroy(playerid, params[])
{
if(PlayerData[playerid][pAdminLevel] < 1) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, COLOR_GREY, "You must be inside a vehicle to destroy it.");
new testcar= GetPlayerVehicleID(playerid);
SendClientMessage(playerid, 0xFFFFFFFF, "You have deleted a car!!");
DestroyVehicle(testcar);
return 1;
}
CMD:givegun(playerid, params[])
{
new id, gun, ammo;
if(PlayerData[playerid][pAdminLevel] < 1) return SendClientMessage(playerid, COLOR_RED, " ** You must be a level 1 Admin to use that! ");
if(sscanf(params,"uii", id, gun, ammo)) return SendClientMessage(playerid, -1,"USAGE: /givegun [playerid/partofname] [gunid] [ammo]");
if(gun > 47 || gun < 1) return SendClientMessage(playerid, -1,"GUN ID'S: 1-47");
if(ammo > 999 || ammo < 1) return SendClientMessage(playerid, -1,"Ammo 1-999");
GivePlayerWeapon(id, gun, ammo);
return 1;
}
CMD:kick(playerid, params[])
{
if(PlayerData[playerid][pAdminLevel] >= 1) {
new PID; //define the playerid we wanna kick
new reason[64]; //the reason, put into a string
new string[128]; //a new message string
new name1[MAX_PLAYERS], name2[MAX_PLAYERS];
if(sscanf(params, "us[64]", PID,reason)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /kick [playerid] [reason]"); //tell sscanf if the parameters/the syntax is written wrong to return a message (PID and the reason used here)
if(!IsPlayerConnected(PID)) // if the ID is wrong or not connected, return a message! (PID used here)
return SendClientMessage(playerid, COLOR_GREY, "Player is not connected!");
format(str, sizeof(str), "'%s' has been kicked by administrator '%s'. Reason: %s ", name2, name1, reason); //format the string we've defined to send the message, playername and adminname are used to receive the information about the names
SendClientMessageToAll(COLOR_RED, string); //send that message to all
SetTimer("kick", 500, false);
Kick(PID); //kick the playerid we've defined
}
else //if he has not got the permissions
{
SendClientMessage(playerid, COLOR_GREY, "You have to be level 3 to use that command!"); //return this message
}
return 1;
}
CMD:ban(playerid, params[])
{
if(PlayerData[playerid][pAdminLevel] >= 1) {
new PID; //define the playerid we wanna kick
new reason[64]; //the reason, put into a string
new string[128]; //a new message string
new name1[MAX_PLAYERS], name2[MAX_PLAYERS];
if(sscanf(params, "us[64]", PID,reason)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /kick [playerid] [reason]"); //tell sscanf if the parameters/the syntax is written wrong to return a message (PID and the reason used here)
if(!IsPlayerConnected(PID)) // if the ID is wrong or not connected, return a message! (PID used here)
return SendClientMessage(playerid, COLOR_GREY, "Player is not connected!");
format(str, sizeof(str), "'%s' has been banned by administrator '%s'. Reason: %s ", name2, name1, reason); //format the string we've defined to send the message, playername and adminname are used to receive the information about the names
SendClientMessageToAll(COLOR_RED, string); //send that message to all
SetTimer("kick", 500, false);
Ban(PID); //kick the playerid we've defined
}
else //if he has not got the permissions
{
SendClientMessage(playerid, COLOR_GREY, "You have to be level 3 to use that command!"); //return this message
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if (dialogid == 1)
{
new name[MAX_PLAYER_NAME], file[256], string[128];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), SERVER_USER_FILE, name);
if(!response) return Kick(playerid);
if (!strlen(inputtext)) return
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Hi your not registered", "Welcome, You are not registrated, enter your password below", "Register", "Leave");
dini_Create(file);
dini_IntSet(file, "Password", udb_hash(inputtext));
dini_IntSet(file, "AdminLevel",PlayerData[playerid][pAdminLevel] = 0);
dini_IntSet(file, "Money",PlayerData[playerid][pCash] = 4500);
dini_IntSet(file, "Score",PlayerData[playerid][pScore] = 0);
dini_IntSet(file, "Banned",PlayerData[playerid][pBan] = 0);
format(string, 128, "[SYSTEM]: You succesfully registered the nickname %s with password %s, you have been auto logged in.", name, inputtext);
SendClientMessage(playerid, COLOR_YELLOW, string);
gPlayerLogged[playerid] = 1;
}
if (dialogid == 2)
{
new name[MAX_PLAYER_NAME], file[256];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), SERVER_USER_FILE, name);
if(!response) return Kick(playerid);
if (!strlen(inputtext)) return ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "You are registered", "Enter your password below", "Login", "Leave");
new tmp;
tmp = dini_Int(file, "Password");
if(udb_hash(inputtext) != tmp) {
SendClientMessage(playerid, COLOR_RED, "Incorrect Password.");
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "You are registrated", "Enter your password below", "Login", "Leave");
}
else
{
gPlayerLogged[playerid] = 1;
PlayerData[playerid][pAdminLevel] = dini_Int(file, "AdminLevel");
SetPlayerScore(playerid, PlayerData[playerid][pScore]);
GivePlayerMoney(playerid, dini_Int(file, "Money")-GetPlayerMoney(playerid));
SendClientMessage(playerid,COLOR_RED, "[SYSTEM]: Successfully logged in!");
}
}
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
SendDeathMessage(killerid, playerid, reason);
GivePlayerMoney(killerid, 250); // + 250
// SetPlayerScore(killerid, + 1);
SetPlayerScore(killerid, PlayerData[killerid][pScore] + 1);
return 1;
}
public OnPlayerSpawn(playerid)
{
GivePlayerWeapon(playerid,24,500);
if(gTeam[playerid] != 1)
{
//RemovePlayerFromVehicle(playerid);
SetPlayerColor(playerid,0xFF00FFAA);
return 1;
}
if(gTeam[playerid] != 2)
{
//RemovePlayerFromVehicle(playerid);
SetPlayerColor(playerid,COLOR_GREEN);
return 1;
}
return 1;
}
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
new Float:HP;
GetPlayerHealth(playerid, HP);
if(weaponid == 24) SetPlayerHealth(playerid, HP-45);//DesertEagle
if(weaponid == 31) SetPlayerHealth(playerid, HP-30);//M4
if(weaponid == 34) SetPlayerHealth(playerid, HP-100);//SniperRifle
if(weaponid == 25) SetPlayerHealth(playerid, HP-60);//PumpShotgun
return 1;
}
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart)
{
if(bodypart == BODY_PART_HEAD)
{
if(issuerid == INVALID_PLAYER_ID && playerid == INVALID_PLAYER_ID) return 0;
return CallLocalFunction("OnPlayerHeadShot", "iif", playerid, issuerid, amount);
}
return true;
}
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid)
{
PlayerPlaySound(playerid, 17802, 0.0, 0.0, 0.0); // Ding Sound
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate==PLAYER_STATE_PASSENGER)
{
new gun,tmp;
GetPlayerWeaponData(playerid,4,gun,tmp);
#pragma unused tmp
if(gun)SetPlayerArmedWeapon(playerid,gun);
else SetPlayerArmedWeapon(playerid,0);
}
return 1;
}
new
gLastShot[ MAX_PLAYERS ];
#define HOLDING(%0) \
((newkeys & (%0)) == (%0))
public OnPlayerKeyStateChange( playerid, newkeys, oldkeys )
{
if ( ( tickcount( ) - gLastShot[ playerid ] ) < 750 )
{
if ( HOLDING( KEY_JUMP | KEY_SPRINT | KEY_CROUCH ) )
{
new
Float: pPos[ 3 ];
GetPlayerPos( playerid, pPos[ 0 ], pPos[ 1 ], pPos[ 2 ] );
SetPlayerPos( playerid, pPos[ 0 ], pPos[ 1 ], pPos[ 2 ] + 10.0 );
GameTextForPlayer( playerid, "~r~Stop c-bugging fool!", 1000, 3 );
gLastShot[ playerid ] = -1;
return 1;
}
if ( newkeys & KEY_CROUCH )
{
SetTimerEx( "__check", 200, false, "i", playerid );
}
}
return 1;
}
forward __check( playerid );
public __check( playerid )
{
if ( GetPlayerSpecialAction( playerid ) == SPECIAL_ACTION_DUCK )
return 1;
new
Float: pPos[ 3 ];
GetPlayerPos( playerid, pPos[ 0 ], pPos[ 1 ], pPos[ 2 ] );
SetPlayerPos( playerid, pPos[ 0 ], pPos[ 1 ], pPos[ 2 ] + 10.0 );
GameTextForPlayer( playerid, "~r~Stop c-bugging fool!!", 1000, 3 );
gLastShot[ playerid ] = -1;
return 1;
}
public OnPlayerWeaponShot( playerid, weaponid, hittype, hitid, Float: fX, Float: fY, Float: fZ )
{
gLastShot[ playerid ] = tickcount( );
return 1;
}
public OnPlayerHeadShot(playerid, issuerid, Float:amount)
{
new
up_string[ 128 ],
pk_string[ 128 char ],
pName[ MAX_PLAYER_NAME ];
GetPlayerName(issuerid, pName, sizeof(pName));
strunpack(up_string, pk_string);
format(up_string, sizeof(up_string), "[DEBUG] - Headshot detected executed by %s[%i] - damage %.3f", pName, playerid, amount);
SendClientMessage(playerid, -1, up_string);
return strpack(up_string, pk_string);
}


