error 001: expected token: ")", but found "return" (+rep)
#1

PAWN ERRORS:
Код:
(15679) : error 001: expected token: ")", but found "return"
(15683) : error 029: invalid expression, assumed zero
(15683) : warning 215: expression has no effect
(15683) : error 001: expected token: ";", but found ")"
(15683) : error 029: invalid expression, assumed zero
(15683) : fatal error 107: too many error messages on one line
Lines 15671 to 15685
Код:
public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid)
{
	if(GetIntVar(damagedid, "JustDied") == 1 || GetIntVar(damagedid, "JustDied") == 2 && isAFK{damagedid}) return 0;
	if(Factions[PlayerInfo[playerid][pFaction]][fType] != FACTION_LEGAL)
	{
		if(TazerActive{playerid} && weaponid == WEAPON_SILENCED && IsPlayerInAnyVehicle(playerid) == 0)
		{
			if(!Dead{damagedid}) return 1;
			if(IsPlayerInAnyVehicle(damagedid) && !IsABiker((GetPlayerVehicleID(damagedid))) return 1;  // ERROR LINE: 15679

			new Float:pos[3];
			GetPlayerPos(damagedid, pos[0], pos[1], pos[2]);
			if(!Tazed{damagedid}) && GetPlayerDistanceFromPoint(playerid, pos[0], pos[1], pos[2]) < 25) // ERROR LINE: 15683
			{
				if(IsPlayerInAnyVehicle(damagedid)) RemovePlayerFromVehicle(damagedid);
Reply
#2

5 opened and 4 closed parentheses in the first line given.

pawn Код:
if(IsPlayerInAnyVehicle(damagedid) && !IsABiker(GetPlayerVehicleID(damagedid))) return 1;
Closing the parenthesis too early (before AND operator) is the cause of the second error given.
pawn Код:
if(!Tazed{damagedid} && GetPlayerDistanceFromPoint(playerid, pos[0], pos[1], pos[2]) < 25)
Reply
#3

PHP код:
public OnPlayerGiveDamage(playeriddamagedidFloat:amountweaponid)
{
    if(
GetIntVar(damagedid"JustDied") == || GetIntVar(damagedid"JustDied") == && isAFK(damagedid)) return 0;
    if(
Factions[PlayerInfo[playerid][pFaction]][fType] != FACTION_LEGAL)
    {
        if(
TazerActive{playerid} && weaponid == WEAPON_SILENCED && IsPlayerInAnyVehicle(playerid) == 0)
        {
            if(!
Dead(damagedid)) return 1;
            if(
IsPlayerInAnyVehicle(damagedid) && !IsABiker((GetPlayerVehicleID(damagedid))) return 1;  // ERROR LINE: 15679
            
new Float:pos[3];
            
GetPlayerPos(damagedidpos[0], pos[1], pos[2]);
            if(!
Tazed(damagedid)) && GetPlayerDistanceFromPoint(playeridpos[0], pos[1], pos[2]) < 25// ERROR LINE: 15683
            
{
                if(
IsPlayerInAnyVehicle(damagedid)) RemovePlayerFromVehicle(damagedid); 
I corrected it for you, the above is correct and your error was:
if(!Dead{damagedid}) return 1;

Instead of:
{damageid}

You had to make it:
(damageid)
Reply
#4

Try this?

Код:
public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid)
{
	if(GetIntVar(damagedid, "JustDied") == 1 || GetIntVar(damagedid, "JustDied") == 2 && isAFK{damagedid}) return 0;
	if(Factions[PlayerInfo[playerid][pFaction]][fType] != FACTION_LEGAL)
	{
		if(TazerActive{playerid} && weaponid == WEAPON_SILENCED && IsPlayerInAnyVehicle(playerid) == 0)
		{
			if(!Dead{damagedid}) return 1;
			if(IsPlayerInAnyVehicle(damagedid) && !IsABiker(GetPlayerVehicleID(damagedid))) return 1;  // ERROR LINE: 15679

			new Float:pos[3];
			GetPlayerPos(damagedid, pos[0], pos[1], pos[2]);
			if(!Tazed{damagedid} && GetPlayerDistanceFromPoint(playerid, pos[0], pos[1], pos[2]) < 25) // ERROR LINE: 15683
			{
				if(IsPlayerInAnyVehicle(damagedid)) RemovePlayerFromVehicle(damagedid);
EDIT: Got beaten twice ((((
Reply
#5

Wow... Silly mistakes always get me.. However i used XBoss30's code and now receive these errors

Код:
(15675) : error 012: invalid function call, not a valid address
(15675) : warning 215: expression has no effect
(15675) : error 001: expected token: ";", but found ")"
(15675) : error 029: invalid expression, assumed zero
(15675) : fatal error 107: too many error messages on one line
Код:
public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid)
{
    if(GetIntVar(damagedid, "JustDied") == 1 || GetIntVar(damagedid, "JustDied") == 2 && isAFK(damagedid)) return 0; // ERROR LINE: 15675
    if(Factions[PlayerInfo[playerid][pFaction]][fType] != FACTION_LEGAL)
    {
        if(TazerActive{playerid} && weaponid == WEAPON_SILENCED && IsPlayerInAnyVehicle(playerid) == 0)
        {
            if(!Dead(damagedid)) return 1;
            if(IsPlayerInAnyVehicle(damagedid) && !IsABiker((GetPlayerVehicleID(damagedid)) return 1;

            new Float:pos[3];
            GetPlayerPos(damagedid, pos[0], pos[1], pos[2]);
            if(!Tazed(damagedid)) && GetPlayerDistanceFromPoint(playerid, pos[0], pos[1], pos[2]) < 25)
            {
                if(IsPlayerInAnyVehicle(damagedid)) RemovePlayerFromVehicle(damagedid);
Reply
#6

XBoss30's code is incorrect because Dead is char-array and not a function.
Reply
#7

Right, so therefor, it should be in {damagedid}?
Reply
#8

Yes, it should. I explained the reason the errors were given in my post and provided the code with the correct number of parentheses.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)