3 Errors
#1

Hello.
I get the following 3 errors:
PHP код:
error 010invalid function or declaration
error 010
invalid function or declaration
error 010
invalid function or declaration 
On this script:
PHP код:
public OnPlayerUpdate(playerid)
{
    new 
Float:H;
    
GetPlayerHealth(playerid,H);
    if(
H<99 && H>1SetPlayerHealth(playerid,10000);
    return 
1;
    }
    new 
Float:h;
    for(new 
ii<500i++) // Erroring Line
    
{
    if(
IsPlayerConnected(i// Erroring Line
    
{
    
GetVehicleHealth(GetPlayerVehicleID(i));
    if(
1000// Erroring Line
    
{
    
SetVehicleHealth(GetPlayerVehicleID(i),1000);
    } } } }

Could someone tell me whats wrong?
Thanks
Reply
#2

PHP код:
public OnPlayerUpdate(playerid)
{
    new 
Float:H;
    
GetPlayerHealth(playerid,H);
    if(
H<99)
    {
        
SetPlayerHealth(playerid,100);
        return 
1;
    }
       if(
IsPlayerConnected(playerid))
       {
        
GetVehicleHealth(GetPlayerVehicleID(playerid), H);
        if(
1000)
        {
            
SetVehicleHealth(GetPlayerVehicleID(playerid),1000);
        }
    }
    return 
1;

Here's correct code.

I should notice though, this is some very bad scripting for the following reasons:

1. You use OnPlayerUpdate to fix cars and heal players, and at 99% health? Use a timer instead, since OPU checks every 20ms which is way too fast for anything.
2. You do a loop through all players in OPU? Why? Its already checking for all players seperate.

You should read up on pawno a little more, this snippet was awfully inefficient, it would work but your server would lagg if you ever got a little more people on.

EDIT: Here's a more efficient code that works just as good but doesn't require nearly as much CPU.

PHP код:
new healtimer[MAX_PLAYERS];
public 
OnPlayerConnect(playerid)
{
    
healtimer[playerid] = SetTimerEx("HealTimer"1000/* Time in milliseconds*/1/*repeating*/"%d"playerid);
    return 
1;
}
public 
OnPlayerDisconnect(playeridreason)
{
    
KillTimer(healtimer[playerid]);
    return 
1;
}
forward HealTimer(playerid);
public 
HealTimer(playerid);
{
    if(
IsPlayerConnected(playerid))
    {
        new 
Float:H;
        
GetPlayerHealth(playerid,H);
        if(
H<90SetPlayerHealth(playerid,100);
        
GetVehicleHealth(GetPlayerVehicleID(playerid), H);
        if(
H<900SetVehicleHealth(GetPlayerVehicleID(playerid),1000);
    }
    return 
1;

Reply
#3

Quote:
Originally Posted by Sinner
Посмотреть сообщение
PHP код:
public OnPlayerUpdate(playerid)
{
    new 
Float:H;
    
GetPlayerHealth(playerid,H);
    if(
H<99)
    {
        
SetPlayerHealth(playerid,100);
        return 
1;
    }
       if(
IsPlayerConnected(playerid))
       {
        
GetVehicleHealth(GetPlayerVehicleID(playerid), H);
        if(
1000)
        {
            
SetVehicleHealth(GetPlayerVehicleID(playerid),1000);
        }
    }
    return 
1;

Here's correct code.

I should notice though, this is some very bad scripting for the following reasons:

1. You use OnPlayerUpdate to fix cars and heal players, and at 99% health? Use a timer instead, since OPU checks every 20ms which is way too fast for anything.
2. You do a loop through all players in OPU? Why? Its already checking for all players seperate.

You should read up on pawno a little more, this snippet was awfully inefficient, it would work but your server would lagg if you ever got a little more people on.
Yes I am sorry,this is a script I made a year ago and I did not use it untill now /=
Thank you very very much anyway
Reply
#4

Quote:
Originally Posted by Montserrat
Посмотреть сообщение
Yes I am sorry,this is a script I made a year ago and I did not use it untill now /=
Thank you very very much anyway
I edited my post, look for a good solution.

EDIT: No problem
Reply
#5

Quote:
Originally Posted by Sinner
Посмотреть сообщение
I edited my post, look for a good solution.

EDIT: No problem
Ah I still get those 3 errors on your last script (with the timer)
Edit: fixed,by accident you did
PHP код:
public HealTimer(playerid); 
Reply
#6

Quote:
Originally Posted by Montserrat
Посмотреть сообщение
Ah I still get those 3 errors on your last script (with the timer)
Edit: fixed,by accident you did
PHP код:
public HealTimer(playerid); 
It needs to be public or it won't work, what's your error?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)