Invalid function
#1

Code:

Код:
public OnPlayerDeath(playerid, killerid, reason)
{
if(DM[playerid] == true)
if(PlayerInfo[playerid][pVip] == 1)
GetPlayerHealth(killerid,health);
SetPlayerHealth(killerid,health + 50.0);
SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
			}
			else
			{
GetPlayerHealth(killerid,health);
SetPlayerHealth(killerid,health + 25.0);
SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
}
Error: error 010: invalid function or declaration

Error line:

else


I want to make if player vip, he get +50 hp when he kill someone, if he doesn't vip, he get for kill only 25 HP.
Reply
#2

Here bruh! You were required to declare a floating(decimal/fractions) variable and clear some code.

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    if(PlayerInfo[playerid][pVip] >= 1)
    {
        new Float:health;
        GetPlayerHealth(killerid,health);
        SetPlayerHealth(killerid,health + 50.0);
        SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
    }
    else
    {
        new Float:health;
        GetPlayerHealth(killerid,health);
        SetPlayerHealth(killerid,health + 25.0);
        SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
    }
}
Reply
#3

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    if(PlayerInfo[playerid][pVip] >= 1)
    {
        new Float:health;
        GetPlayerHealth(killerid,health);
        SetPlayerHealth(killerid,health + 50.0);
        SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
    }
    else
    {
        new Float:health;
        GetPlayerHealth(killerid,health);
        SetPlayerHealth(killerid,health + 25.0);
        SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
    }
    return 1;
}
forget return value
Reply
#4

Now i get these warnings:
Код:
C:\Users\Lauryno\Desktop\Servas\gamemodes\bom.pwn(163) : warning 219: local variable "health" shadows a variable at a preceding level
C:\Users\Lauryno\Desktop\Servas\gamemodes\bom.pwn(170) : warning 219: local variable "health" shadows a variable at a preceding level
C:\Users\Lauryno\Desktop\Servas\gamemodes\bom.pwn(528) : warning 203: symbol is never used: "health"
Reply
#5

Try this one!

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    if(PlayerInfo[playerid][pVip] >= 1)
    {
        GetPlayerHealth(killerid,health);
        SetPlayerHealth(killerid,health + 50.0);
        SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
    }
    else
    {
        GetPlayerHealth(killerid,health);
        SetPlayerHealth(killerid,health + 25.0);
        SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
    }
    return 1;
}
Reply
#6

Ballu, no warnings or errors, i test this script tomorrow, thanks
Reply
#7

Quote:
Originally Posted by Louris
Посмотреть сообщение
Ballu, no warnings or errors, i test this script tomorrow, thanks
Cool! Not a problem.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)