PDA

View Full Version : Error 021


Gecko75
20/10/2013, 11:30 PM
So, I've been trying to compile my script, but it's giving me error 021.

Here's the error.

C:\Users\Scoot\Desktop\GSRP\gamemodes\gecko.pwn(25 115) : error 021: symbol already defined: "OnPlayerUpdate"

Line 25115-
{

all of the code for OnPlayerUpdate

public OnPlayerUpdate(playerid)
{
if(!aDuty[playerid] && IsPlayerInAnyVehicle(playerid) == 1 && Seatbelt[playerid] == 0)
{
new Float:TempCarHealth;
GetVehicleHealth(GetPlayerVehicleID(playerid), TempCarHealth);
new Float:Difference = floatsub(CarHealth[playerid], TempCarHealth);
if((floatcmp(CarHealth[playerid], TempCarHealth) == 1) && (floatcmp(Difference,100.0) == 1))
{
Difference = floatdiv(Difference, 10.0);
new Float:OldHealth;
GetPlayerHealth(playerid, OldHealth);
SetPlayerHealth(playerid, floatsub(OldHealth, Difference));
}
CarHealth[playerid] = TempCarHealth;
}
else
{
CarHealth[playerid] = 0.0; //To avoid that a player dies when he enters a vehicle
}
new pCurWeap = GetPlayerWeapon(playerid);
if(pCurWeap != pCurrentWeapon[playerid])
{
OnPlayerChangeWeapon(playerid, pCurWeap);
pCurrentWeapon[playerid] = pCurWeap;
}
if(IsPlayerLoggedIn(playerid))
{
foreach(Player, i)
{
if(PlayerInfo[i][pMaskuse] == 1)
{
ShowPlayerNameTagForPlayer(playerid, i, 0);
}
}
if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USEJETPACK && JetPack[playerid] == 0 && PlayerInfo[playerid][pAdmin] < 4)
{
new string[74 + MAX_PLAYER_NAME];
format( string, sizeof( string ), "{AA3333}AdmCmding{FFFF00}: %s (ID %d) may possibly be jetpack hacking.", RPN(playerid), playerid);
SendAdminMessage(ADMIN, 4, string);
}
if(GetPVarInt(playerid, "laser") == 1)
{
RemovePlayerAttachedObject(playerid, 0);
if ((IsPlayerInAnyVehicle(playerid)) || (IsPlayerInWater(playerid))) return 1;
switch (GetPlayerWeapon(playerid))
{
case 23:
{
if (IsPlayerAiming(playerid))
{
if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK)
{
SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SP standing aiming
0.108249, 0.030232, 0.118051, 1.468254, 350.512573, 364.284240);
}
else
{
SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SP crouched aiming
0.108249, 0.030232, 0.118051, 1.468254, 349.862579, 364.784240);
}
}
else
{
if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK)
{
SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SP standing not aiming
0.078248, 0.027239, 0.113051, -11.131746, 350.602722, 362.384216);
}
else
{
SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SP crouched not aiming
0.078248, 0.027239, 0.113051, -11.131746, 350.602722, 362.384216);
}
}
}
case 27:
{
if (IsPlayerAiming(playerid))
{
if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK)
{
SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SPAS standing aiming
0.588246, -0.022766, 0.138052, -11.531745, 347.712585, 352.784271);
}
else
{
SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SPAS crouched aiming
0.588246, -0.022766, 0.138052, 1.468254, 350.712585, 352.784271);
}
}
else
{
if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK)
{
SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SPAS standing not aiming
0.563249, -0.01976, 0.134051, -11.131746, 351.602722, 351.384216);
}
else
{
SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SPAS crouched not aiming
0.563249, -0.01976, 0.134051, -11.131746, 351.602722, 351.384216);
}
}
}
case 30:
{
if (IsPlayerAiming(playerid))
{
if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK)
{
SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // AK standing aiming
0.628249, -0.027766, 0.078052, -6.621746, 352.552642, 355.084289);
}
else
{
SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // AK crouched aiming
0.628249, -0.027766, 0.078052, -1.621746, 356.202667, 355.084289);
}
}
else
{
if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK)
{
SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // AK standing not aiming
0.663249, -0.02976, 0.080051, -11.131746, 358.302734, 353.384216);
}
else
{
SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // AK crouched not aiming
0.663249, -0.02976, 0.080051, -11.131746, 358.302734, 353.384216);
}
}
}
case 31:
{
if (IsPlayerAiming(playerid))
{
if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK)
{
SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // M4 standing aiming
0.528249, -0.020266, 0.068052, -6.621746, 352.552642, 355.084289);
}
else
{
SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // M4 crouched aiming
0.528249, -0.020266, 0.068052, -1.621746, 356.202667, 355.084289);
}
}
else
{
if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK)
{
SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // M4 standing not aiming
0.503249, -0.02376, 0.065051, -11.131746, 357.302734, 354.484222);
}
else
{
SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // M4 crouched not aiming
0.503249, -0.02376, 0.065051, -11.131746, 357.302734, 354.484222);
}
}
}
case 29:
{
if (IsPlayerAiming(playerid))
{
if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK)
{
SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // MP5 standing aiming
0.298249, -0.02776, 0.158052, -11.631746, 359.302673, 357.584259);
}
else
{
SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // MP5 crouched aiming
0.298249, -0.02776, 0.158052, 8.368253, 358.302673, 352.584259);
}
}
else
{
if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK)
{
SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // MP5 standing not aiming
0.293249, -0.027759, 0.195051, -12.131746, 354.302734, 352.484222);
}
else
{
SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // MP5 crouched not aiming
0.293249, -0.027759, 0.195051, -12.131746, 354.302734, 352.484222);
}
}
}
}
}
// Boxing
if(Boxing[playerid] && !BoxTime)
{
new string[128];
new Float:bH; GetPlayerHealth(playerid, bH);
if(bH <= 20)
{
// Getting other boxer's ID
new playerb = -1;
foreach(Player, i)
{
if(Boxing[i] && i != playerid) playerb = i;
}
if(playerb != -1)
{
format(string, sizeof(string), "Boxing Ring: The boxing match has ended, %s has won the match.", RPN(playerb));
SendGymMessage(COLOR_WHITE, string);
// Putting them out of the ring
SetPlayerPos(playerb, 760.9759,4.7187,1000.7084);
SetPlayerFacingAngle(playerb, 268.9407);
SetPlayerPos(playerid, 760.9759,6.1794,1000.7093);
SetPlayerFacingAngle(playerid, 268.9407);
// Giving the winner extra skill point
new oldj = strval(RPJL(playerb, JOB_BOXER));
PlayerInfo[playerb][pJobSkill][JOB_BOXER] ++;
new newj = strval(RPJL(playerb, JOB_BOXER));
if(oldj < newj)
{
format(string, sizeof(string), "** Your Boxer level is now %d, you can now cause %d more damage. **", newj, (newj*2)-2);
SendClientMessage(playerb, COLOR_YELLOW, string);
}
//
SendClientMessage(playerb, COLOR_LIME, " You have won the boxing match.");
SendClientMessage(playerid, COLOR_LIGHTRED, " You have lost the boxing match.");
// Giving Bids
new winner = pBoxer[playerb];
foreach(Player, i)
{
if(BidBoxer[i] == winner)
{
new percent, profit;
percent = (BidAmount[i]/BoxerBid[winner]) * 100;
profit = (percent * BoxerBid[pBoxer[playerid]]) / 100;
GiveDodMoney(i, BidAmount[i] + profit);
format(string, sizeof(string), " You have won $%d from bidding in the match, the money you bid has been returned as well.", profit);
SendClientMessage(i, COLOR_LIME, string);
}
BidAmount[i] = 0;
BidBoxer[i] = 0;
}
for(new w = 0; w < 13; w++)
{
GiveDodWeapon(playerb, PlayerInfo[playerb][pWeapon][w], PlayerInfo[playerb][pWeaponAmmo][w]);
}
}
for(new w = 0; w < 13; w++)
{
GiveDodWeapon(playerid, PlayerInfo[playerid][pWeapon][w], PlayerInfo[playerid][pWeaponAmmo][w]);
}
// Resetting Values
BoxingMatch = 0;
Boxer[1] = -1;
pBoxer[playerb] = 0;
Boxer[2] = -1;
pBoxer[playerid] = 0;
Boxing[playerb] = 0;
Boxing[playerid] = 0;
BoxerBid[1] = 0;
BoxerBid[2] = 0;
}
}
// Spikes
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if(!IsGovOfficial(playerid))
{
for(new i = 0; i < sizeof(SpikeInfo); i++)
{
if(IsPlayerInRangeOfPoint(playerid, 3.0, SpikeInfo[i][sX], SpikeInfo[i][sY], SpikeInfo[i][sZ]))
{
if(SpikeInfo[i][sCreated] == 1)
{
new panels, doors, lights, tires;
new carid = GetPlayerVehicleID(playerid);
GetVehicleDamageStatus(carid, panels, doors, lights, tires);
tires = encode_tires(1, 1, 1, 1);
UpdateVehicleDamageStatus(carid, panels, doors, lights, tires);
}
}
}
}
}
// Fuel
new vehicleid = GetPlayerVehicleID(playerid);
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER && Fuel[vehicleid] <= 0)
{
new engine, lights, alarm, doors, bonnet, boot, objective, string[128];
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
if(engine)
{
SetVehicleParamsEx(vehicleid, 0, 0, 0, 0, 0, 0, 0);
if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pVeh])
{SetVehicleParamsEx(vehicleid, 0, 0, 0, PlayerInfo[playerid][vLocked], 0, 0, 0);}
if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pVVeh])
{SetVehicleParamsEx(vehicleid, 0, 0, 0, PlayerInfo[playerid][vVLocked], 0, 0, 0);}
format(string, sizeof(string), "* %s's vehicle stops as it has no fuel in its tank.", RPN(playerid));
ProxDetector(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
}
}
// Drag
if(Dragged[playerid] != -1)
{
new playerb = Dragged[playerid];
new Float:pos[3];
GetPlayerPos(playerb, pos[0], pos[1], pos[2]); //cop
SetPlayerPos(playerid, pos[0]+0.5, pos[1]+0.5, pos[2]); //suspect
SetPlayerInterior(playerid, GetPlayerInterior(playerb));
SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(playerb));
if(GetPlayerState(playerb) == 2 || GetPlayerState(playerb) == 3)
{
new iVehID = GetPlayerVehicleID(playerb);
if(!IsPlayerInAnyVehicle(playerid))
{
if(IsSeatAvailable(iVehID, 2)) PutPlayerInVehicle(playerid, iVehID, 2);
else PutPlayerInVehicle(playerid, iVehID, 3);
TogglePlayerControllable(playerid,0);
Drag[playerid] = -1;
Drag[playerb] = -1;
Dragged[playerid] = -1;
Dragged[playerb] = -1;
}
}
}
// AntiCS
new Keys, ud, lr;
GetPlayerKeys(playerid, Keys, ud, lr);
if(CheckCrouch[playerid] == 1) {
switch(WeaponID[playerid]) {
case 23..25, 27, 29..34, 41: {
if((Keys & KEY_CROUCH) && !((Keys & KEY_FIRE) || (Keys & KEY_HANDBRAKE)) && GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK ) {
if(Ammo[playerid][GetPlayerWeapon(playerid)] > GetPlayerAmmo(playerid)) {
// OnPlayerCBug(playerid);
}
}
//else SendClientMessage(playerid, COLOR_RED, "Failed in onplayer update");
}
}
}

if(!ud && !lr) { NotMoving[playerid] = 1; /*OnPlayerKeyStateChange(playerid, Keys, 0);*/ }
else { NotMoving[playerid] = 0; /*OnPlayerKeyStateChange(playerid, Keys, 0);*/ }
// Alt-Tab detection
AltTabbed[playerid] = 0;
// Speedlimit
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER && Speedlimit[playerid])
{
new a, b, c;
GetPlayerKeys(playerid, a, b ,c);
if(a == 8 && GetVehicleSpeed(GetPlayerVehicleID(playerid), 0) > Speedlimit[playerid])
{
new newspeed = GetVehicleSpeed(GetPlayerVehicleID(playerid), 0) - Speedlimit[playerid];
ModifyVehicleSpeed(GetPlayerVehicleID(playerid), -newspeed);
}
}
// Ping Update
if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING && PlayerInfo[playerid][pAdmin] > 1)
{
new string[64];
format(string,sizeof(string),"~n~~n~~n~~n~~n~~n~~n~~n~~r~%s's Ping: ~w~%d", RPN(Specid[playerid]), GetPlayerPing(Specid[playerid]));
GameTextForPlayer(playerid, string, 1000, 3);
}
// Money Anticheat
if(GetPlayerMoney(playerid) != PlayerInfo[playerid][pMoney])
{
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][pMoney]);
}
// Speedometer
if(Speedo[playerid] && IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new string[64], speed = GetVehicleSpeed(GetPlayerVehicleID(playerid), 0);
if(speed > 100) format(string,sizeof(string),"~r~%d ~w~MPH", speed);
else format(string,sizeof(string),"%d MPH", speed);
PlayerTextDrawSetString(playerid, SpeedTD[playerid], string);
PlayerTextDrawShow(playerid, SpeedTD[playerid]);
//format(string,sizeof(string),"~n~~n~~n~~n~~n~~n~~n~~n~~r~Speedometer: ~w~%d MPH", speed);
//GameTextForPlayer(playerid, string,1000, 3);
}
else
{
PlayerTextDrawHide(playerid, SpeedTD[playerid]);
}
// SpeedCheck
if(IsPlayerInAnyVehicle(playerid) && IsAAdmin(playerid) && IsAFlight(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new speed = GetVehicleSpeed(GetPlayerVehicleID(playerid), 0);
if(speed > 205 && GetVehicleModel(GetPlayerVehicleID(playerid)) != 519 && GetVehicleModel(GetPlayerVehicleID(playerid)) != 553 && GetVehicleModel(GetPlayerVehicleID(playerid)) != 592 && IsAAdmin(playerid) || speed > 240)
{
new string[128];
format(string, sizeof(string), "AdmCmd: %s might be using speed hacks (%d MPH)", RPN(playerid), speed);
SendAdminMessage(ADMIN, 1, string);
}
}
// Fuel
if(fMeter[playerid] && IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new string[64];
format(string,sizeof(string),"%d%", Fuel[GetPlayerVehicleID(playerid)]);
PlayerTextDrawSetString(playerid, FuelTD[playerid], string);
PlayerTextDrawShow(playerid, FuelTD[playerid]);
//GameTextForPlayer(playerid, string,1000, 3);
}
else
{
PlayerTextDrawHide(playerid, FuelTD[playerid]);
}
}
return 1;
}

Krakuski
21/10/2013, 02:48 AM
Theres already a "OnPlayerUpdate" Somewhere in your script, use Ctrl+F, and type in "OnPlayerUpdate", You should be able to find a secondary one. If there are things in it, transfer it over to the other one, and delete it.

Gecko75
22/10/2013, 11:36 PM
Nope- there's nothing else involving OnPlayerUpdate. I can't figure out what the issue is.

Unri
22/10/2013, 11:42 PM
Check if you have defined some .pwn file. You may find your second OnPlayerUpdate there.

park4bmx
23/10/2013, 12:15 AM
It's inside another include in that FS