Error 021: symbol already defined: "OnPlayerTakeDamage"
#1

I dont know why, the error is on the bracket line.

PHP код:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart)
{ 
// This one 
Код:
a.tmp(90306): error 021: symbol already defined: "OnPlayerTakeDamage"
*Note: I used SKY plugin and weapon-config include.

I'm Newbie in scripting. So Please help.
Reply
#2

check your script you have used Onplayertakedmage 2 times remove 1 to fix it
Reply
#3

Change OnPlayerTakeDamage with:

PHP код:
public OnPlayerDamage(&playerid, &Float:amount, &issuerid, &weapon, &bodypart) 
Reply
#4

it looks like u're using OnPlayerTakeDamage<-- 2 times.
just find another one and connect to ea.
than remove one of them.
Reply
#5

Quote:
Originally Posted by Mugalito
Посмотреть сообщение
it looks like u're using OnPlayerTakeDamage<-- 2 times.
just find another one and connect to ea.
than remove one of them.
He is not using it 2 times, i already told him the solution, check the reply above you
Reply
#6

Good. Now it has more error.
PHP код:
public OnPlayerTakeDamage(&playerid, &Float:amount, &issuerid, &weapon, &bodypart)
{ 
// error 021
    
if(bodypart == 3) PlayerInfo[playerid][pBodyStatus][0] -= frandom(1.0);
    if(
bodypart == 4) PlayerInfo[playerid][pBodyStatus][1] -= frandom(1.0);
    if(
bodypart == 5) PlayerInfo[playerid][pBodyStatus][3] -= frandom(1.0);
    if(
bodypart == 6) PlayerInfo[playerid][pBodyStatus][2] -= frandom(1.0);
    if(
bodypart == 7) PlayerInfo[playerid][pBodyStatus][5] -= frandom(1.0);
    if(
bodypart == 8) PlayerInfo[playerid][pBodyStatus][4] -= frandom(1.0);
    
ShowBloodScreen(playerid, amount);
    new 
status[64], Float:health, Float:armor, string[128];
    
GetPlayerHealth(playerid, health);
    
GetPlayerArmour(playerid, armor);
    
format(status, sizeof(status), "Stranger_%d\n{ff0000}H: %.1f\n{ffffff}A: %.1f", RandMask[playerid], health, armor);
    
UpdateDynamic3DTextLabelText(MaskText[playerid], 0xFFFFFFFF, status);
    if(
issuerid != INVALID_PLAYER_ID && weaponid == 31 && bodypart == 9) //error 017
    
{
        if(!
PlayerInfo[playerid][pHS])
        {
            
PlayerInfo[playerid][pHS] = 1;
            
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            
SetTimerEx("KillPlayer",2000,0,"i",playerid);
        }
    }
    if(
issuerid != INVALID_PLAYER_ID && weaponid == 34 && bodypart == 9) //error 017
    
{
        if(!
PlayerInfo[playerid][pHS])
        {
            
PlayerInfo[playerid][pHS] = 1;
            
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            
SetTimerEx("KillPlayer",2000,0,"i",playerid);
        }
    }
    if(
issuerid != INVALID_PLAYER_ID && weaponid == 24 && bodypart == 9) //error 017
    
{
        if(!
PlayerInfo[playerid][pHS])
        {
            
PlayerInfo[playerid][pHS] = 1;
            
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            
SetTimerEx("KillPlayer",2000,0,"i",playerid);
        }
    }
    if(
issuerid != INVALID_PLAYER_ID && weaponid == 30 && bodypart == 9) //error 017
    
{
        if(!
PlayerInfo[playerid][pHS])
        {
            
PlayerInfo[playerid][pHS] = 1;
            
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            
SetTimerEx("KillPlayer",2000,0,"i",playerid);
        }
    }
    if(
issuerid != INVALID_PLAYER_ID && weaponid == 25 && bodypart == 9) //error 017
    
{
        if(!
PlayerInfo[playerid][pHS])
        {
            
PlayerInfo[playerid][pHS] = 1;
            
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            
SetTimerEx("KillPlayer",2000,0,"i",playerid);
        }
    }
    if(
issuerid != INVALID_PLAYER_ID && weaponid == 27 && bodypart == 9) //error 017
    
{
        if(!
PlayerInfo[playerid][pHS])
        {
            
PlayerInfo[playerid][pHS] = 1;
            
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            
SetTimerEx("KillPlayer",2000,0,"i",playerid);
        }
    }
    if(
issuerid != INVALID_PLAYER_ID && bodypart == 7)
    {
        if(!
PlayerInfo[playerid][pLLS])
        {
            
PlayerInfo[playerid][pLLS] = 1;
            
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            
ApplyAnimation(playerid,"CRACK", "crckdeth2", 4.1, 1, 0, 0, 1, 600);
        }
    }
    if(
issuerid != INVALID_PLAYER_ID && bodypart == 8)
    {
        if(!
PlayerInfo[playerid][pRLS])
        {
            
PlayerInfo[playerid][pRLS] = 1;
            
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            
ApplyAnimation(playerid,"CRACK", "crckdeth2", 4.1, 1, 0, 0, 1, 600);
        }
    }
    if(
issuerid != INVALID_PLAYER_ID && bodypart == 5)
    {
        if(!
PlayerInfo[playerid][pLAS])
        {
            
PlayerInfo[playerid][pLAS] = 1;
            
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        }
    }
    if(
issuerid != INVALID_PLAYER_ID && bodypart == 6)
    {
        if(!
PlayerInfo[playerid][pRAS])
        {
            
PlayerInfo[playerid][pRAS] = 1;
            
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        }
    }
    if(
issuerid != INVALID_PLAYER_ID && bodypart == 4)
    {
        if(!
PlayerInfo[playerid][pCS])
        {
            if(
health < 15)
            {
                
PlayerInfo[playerid][pCS] = 1;
                
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                
SetTimerEx("KillPlayer",3000,0,"i",playerid);
            }
        }
    }
    if(
issuerid != INVALID_PLAYER_ID && bodypart == 3)
    {
        if(!
PlayerInfo[playerid][pTS])
        {
            if(
health < 15)
            {
                
PlayerInfo[playerid][pTS] = 1;
                
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                
SetTimerEx("KillPlayer",3000,0,"i",playerid);
            }
        }
    }
    return 
1;
} 
Код:
a.TMP(90306) : error 021 : symbol already defined: "OnPlayerTakeDamage"
a.TMP(90321) : error 017 : undefined symbol "weaponid"
a.TMP(90330) : error 017 : undefined symbol "weaponid"
a.TMP(90339) : error 017 : undefined symbol "weaponid"
a.TMP(90348) : error 017 : undefined symbol "weaponid"
a.TMP(90357) : error 017 : undefined symbol "weaponid"
a.TMP(90366) : error 017 : undefined symbol "weaponid"
Reply
#7

First of all, the solution for weaponid, is actually called "weapon" in your function, so change that accordingly.
Reply
#8

Thanks, edyun, but it comes with a weird different error

PHP код:
new VehicleData[][VehicleDataEnum] = {
    {
"Admiral", 445, 150000},
    {
"Alpha", 602, 300000},
    {
"Ambulance", 416, 5000000}, //line 5715, error 025
    
{"Andromada", 592, 50000},
    {
"Article Trailer", 591, 90000},
    {
"AT400", 577, 50000},
    {
"Baggage", 485, 50000},
    {
"Baggage Trailer A", 606, 50000},
    {
"Baggage Trailer B", 607, 50000},
    {
"Bandito", 568, 500000},
    {
"Banshee", 429, 200000},
    {
"Barracks", 433, 420000},
    {
"Beagle", 511, 50000},
    {
"Benson", 499, 190000},
    {
"Berkley's RC Van", 459, 230000},
    {
"BF Injection", 424, 300000},
    {
"BF-400", 581, 150000},
    {
"Bike", 509, 500},
    {
"Blade", 536, 300000},
    {
"Blista Compact", 496, 150000},
    {
"Bloodring Banger", 504, 300000},
    {
"BMX", 481, 1000},
    {
"Bobcat", 422, 160000},
    {
"Boxville 1", 498, 120000},
    {
"Boxville 2", 609, 120000},
    {
"Bravura", 401, 200000},
    {
"Broadway", 575, 260000},
    {
"Brownstreak (train)", 538, 50000},
    {
"Buccaneer", 518, 220000},
    {
"Buffalo", 402, 300000},
    {
"Bullet", 541, 500000},
    {
"Burrito", 482, 250000},
    {
"Bus", 431, 50000},
    {
"Cabbie", 438, 200000},
    {
"Caddy", 457, 100000},
    {
"Cadrona", 527, 260000},
    {
"Camper", 483, 280000},
    {
"Cargo Trailer", 435, 90000},
    {
"Cargobob", 548, 5000000},
    {
"Cement Truck", 524, 50000},
    {
"Cheetah", 415, 350000},
    {
"Clover", 542, 150000},
    {
"Club", 589, 300000},
    {
"Coach", 437, 50000},
    {
"Coastguard", 472, 500000},
    {
"Combine Harvester", 532, 50000},
    {
"Comet", 480, 400000},
    {
"Cropduster",512, 600000},
    {
"DFT-30", 578, 400000},
    {
"Dinghy", 473, 250000},
    {
"Dodo", 593, 500000},
    {
"Dozer", 486, 50000},
    {
"Dumper", 406, 50000},
    {
"Dune", 573, 500000},
    {
"Elegant", 507, 200000},
    {
"Elegy", 562, 350000},
    {
"Emperor", 585, 200000},
    {
"Enforcer", 427, 50000},
    {
"Esperanto", 419, 150000},
    {
"Euros", 587, 250000},
    {
"Faggio", 462, 50000},
    {
"Farm Trailer", 610, 50000},
    {
"FBI Rancher", 490, 5000000},
    {
"FBI Truck", 528, 50000},
    {
"FCR-900", 521, 150000},
    {
"Feltzer", 533, 150000},
    {
"Firetruck", 407, 50000},
    {
"Firetruck LA", 544, 50000},
    {
"Flash", 565, 250000},
    {
"Flatbed", 455, 50000},
    {
"Fluids Trailer", 584, 100000},
    {
"Forklift", 530, 200000},
    {
"Fortune", 526, 150000},
    {
"Freeway", 463, 180000},
    {
"Freight (train)", 537, 50000},
    {
"Freight Box Trailer (train)", 590, 50000},
    {
"Freight Flat Trailer (train)", 569, 50000},
    {
"Glendale", 466, 100000},
    {
"Glendale Shit", 604, 50000},
    {
"Greenwood", 492, 150000},
    {
"Hermes", 474, 120000},
    {
"Hotdog", 588, 50000},
    {
"Hotknife", 434, 350000},
    {
"Hotring Racer 1", 494, 500000},
    {
"Hotring Racer 2", 502, 500000},
    {
"Hotring Racer 3", 503, 500000},
    {
"HPV1000", 523, 50000},
    {
"Hunter", 425, 400000},
    {
"Huntley", 579, 200000},
    {
"Hustler", 545, 150000},
    {
"Hydra", 520, 50000},
    {
"Infernus", 411, 350000},
    {
"Intruder", 546, 150000},
    {
"Jester", 559, 250000},
    {
"Jetmax", 493, 300000},
    {
"Journey", 508, 200000},
    {
"Kart", 571, 510000},
    {
"Landstalker", 400, 300000},
    {
"Launch", 595, 250000},
    {
"Leviathan", 417, 350000},
    {
"Linerunner", 403, 250000},
    {
"Majestic", 517, 150000},
    {
"Manana", 410, 160000},
    {
"Marquis", 484, 200000},
    {
"Maverick", 487, 1000000},
    {
"Merit", 551, 250000},
    {
"Mesa", 500, 300000},
    {
"Monster", 444, 3000000},
    {
"Monster A", 556, 3000000},
    {
"Monster B", 557, 3000000},
    {
"Moonbeam", 418, 200000},
    {
"Mountain Bike", 510, 1100},
    {
"Mower", 572, 60000},
    {
"Mr Whoopee", 423, 110000},
    {
"Mule", 414, 200000},
    {
"Nebula", 516, 200000},
    {
"Nevada", 553, 300000},
    {
"Newsvan", 582, 230000},
    {
"NRG-500", 522, 300000},
    {
"Oceanic", 467, 150000},
    {
"Ore Trailer", 450, 90000},
    {
"Packer", 443, 150000},
    {
"Patriot", 470, 300000},
    {
"PCJ-600", 461, 200000},
    {
"Perenniel", 404, 150000},
    {
"Phoenix", 603, 300000},
    {
"Picador", 600, 200000},
    {
"Pizzaboy", 448, 70000},
    {
"Police Car (LSPD)", 596, 50000},
    {
"Police Car (LVPD)", 598, 50000},
    {
"Police Car (SFPD)", 597, 50000},
    {
"Police Maverick", 497, 50000},
    {
"Police Ranger", 599, 50000},
    {
"Pony", 413, 100000},
    {
"Predator", 430, 50000},
    {
"Premier", 426, 200000},
    {
"Previon", 436, 150000},
    {
"Primo", 547, 120000},
    {
"Quad", 471, 200000},
    {
"Raindance", 563, 1500000},
    {
"Rancher 1", 489, 250000},
    {
"Rancher 2", 505, 250000},
    {
"RC Bandit", 441, 50000},
    {
"RC Baron", 464, 50000},
    {
"RC Cam", 594, 50000},
    {
"RC Goblin", 501, 50000},
    {
"RC Raider", 465, 50000},
    {
"RC Tiger", 564, 50000},
    {
"Reefer", 453, 200000},
    {
"Regina", 479, 160000},
    {
"Remington", 534, 200000},
    {
"Rhino", 432, 50000},
    {
"Roadtrain", 515, 500000},
    {
"Romero", 442, 300000},
    {
"Rumpo", 440, 150000},
    {
"Rustler", 476, 350000},
    {
"Sabre", 475, 250000},
    {
"Sadler", 543, 250000},
    {
"Sadler Shit", 605, 50000},
    {
"SAN News Maverick", 488, 1500000},
    {
"Sanchez", 468, 260000},
    {
"Sandking", 495, 1000000},
    {
"Savanna", 567, 200000},
    {
"Seasparrow", 447, 540000},
    {
"Securicar", 428, 350000},
    {
"Sentinel", 405, 190000},
    {
"Shamal", 519, 5000000},
    {
"Skimmer", 460, 2000000},
    {
"Slamvan", 535, 250000},
    {
"Solair", 458, 300000},
    {
"Sparrow", 469, 500000},
    {
"Speeder", 452, 200000},
    {
"Squallo", 446, 250000},
    {
"Stafford", 580, 150000},
    {
"Stallion", 439, 250000},
    {
"Stratum", 561, 300000},
    {
"Streak Trailer (train)", 570, 50000},
    {
"Stretch", 409, 1400000},
    {
"Stuntplane", 513, 1350000},
    {
"Sultan", 560, 450000},
    {
"Sunrise", 550, 250000},
    {
"Super GT", 506, 300000},
    {
"S.W.A.T.", 601, 50000},
    {
"Sweeper", 574, 50000},
    {
"Tahoma", 566, 150000},
    {
"Tampa", 549, 200000},
    {
"Tanker", 514, 250000},
    {
"Taxi", 420, 200000},
    {
"Tornado", 576, 150000},
    {
"Towtruck", 525, 300000},
    {
"Tractor", 531, 250000},
    {
"Tram", 449, 50000},
    {
"Trashmaster", 408, 50000},
    {
"Tropic", 454, 350000},
    {
"Tug", 583, 50000},
    {
"Tug Stairs Trailer", 608, 50000},
    {
"Turismo", 451, 550000},
    {
"Uranus", 558, 350000},
    {
"Utility Trailer", 611, 50000},
    {
"Utility Van", 552, 50000},
    {
"Vincent", 540, 200000},
    {
"Virgo", 491, 250000},
    {
"Voodoo", 412, 160000},
    {
"Vortex", 539, 500000},
    {
"Walton", 478, 100000},
    {
"Washington", 421, 200000},
    {
"Wayfarer", 586, 200000},
    {
"Willard", 529, 150000},
    {
"Windsor", 555, 150000},
     {
"Yankee", 456, 250000},
    {
"Yosemite", 554, 350000},
    {
"ZR-350", 477, 350000}
}; 
Код:
weapon-config.inc(5715) : error 025 : function heading differs from prototype
maybe i should open the include?
Reply
#9

Okay, if none can help me solve this problem, I will delete the SKY plugin and weapon-config include
(Removed them and script has no error.)
Reply
#10

Quote:
Originally Posted by Dirda
Посмотреть сообщение
Okay, if none can help me solve this problem, I will delete the SKY plugin and weapon-config include
(Removed them and script has no error.)
Bro you can keep it, this is what you need to do.

1. Download the latest version of weapon-config.

2. After that, put weapon-config.inc on your pawno/includes folder. Then, download SKY.dll or SKY.so and put it into your server/plugins

3. Include weapon-config on your script (#include <weapon-config>)

4. Add SKY.dll or SKY.so in your server.cfg at plugins

5. Open the script, use ctrl+f and search for OnPlayerTakeDamage

6. Replace OnPlayerTakeDamage with the code that you can find down there:

PHP код:
public OnPlayerDamage(&playerid, &Float:amount, &issuerid, &weapon, &bodypart) 
This is the way it works, i have faced this problem myself and this is the solution.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)