SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 23/05/2018, 02:28 PM   #1
MandaleMecha
Little Clucker
 
Join Date: Feb 2016
Posts: 7
Reputation: 0
Default Help, i have a error

I need this command does not add more life

public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == City)
{
GameTextForPlayer(playerid, " Estas En Tierra Robada ", 6000,1);
GivePlayerWeapon(playerid, 46, 1);
SetPlayerHealth(playerid, 94);
SetPlayerPos(playerid,-1492.5255,2509.5999,601.1897);
SetPlayerVirtualWorld(playerid, -1);
SetTimerEx("FuncionVida",1000,true,"i",playerid);
}
return 1;
}


forward FuncionVida();
public FuncionVida()
{
for(new i;i<MAX_PLAYERS;i++)
{
new funcionvidaa[i] = SetTimerEx("FuncionVida",1000,true,"i",playerid);
if(IsPlayerConnected(i)) // Verifica que el jugador esté conectado y logeado
{
GetPlayerHealth(i, health); //Estableciendo el valor flotante health con GetPlayerHealth
if(health > 0) //Si su vida es mayor a 0...
SetPlayerHealth(i, health+5); //Da +5 de vida al jugado
else
if(health > 95)
KillTimer(funcionvidaa[i])
}

}
return 1;
}

The error in this line

new funcionvidaa[i] = SetTimerEx("FuncionVida",1000,true,"i",playerid);

HELP !!!!
MandaleMecha is offline   Reply With Quote
Old 23/05/2018, 02:37 PM   #2
Kraeror
Huge Clucker
 
Kraeror's Avatar
 
Join Date: Mar 2017
Location: Bulgaria
Posts: 449
Reputation: 19
Default Re: Help, i have a error

Can you show us the error?
Kraeror is offline   Reply With Quote
Old 23/05/2018, 02:48 PM   #3
Lokii
Huge Clucker
 
Join Date: Sep 2017
Posts: 280
Reputation: 72
Default Re: Help, i have a error

1 you forgot to declare health
2 you'r brackets were bad

PHP Code:
if
}

fix:

PHP Code:
public OnPlayerPickUpPickup(playeridpickupid)
{
    if(
pickupid == City)
    {
        
GameTextForPlayer(playerid" Estas En Tierra Robada "6000,1);
        
GivePlayerWeapon(playerid461);
        
SetPlayerHealth(playerid94);
        
SetPlayerPos(playerid,-1492.5255,2509.5999,601.1897);
        
SetPlayerVirtualWorld(playerid, -1);
        
SetTimerEx("FuncionVida",1000,true,"i",playerid);
    }
    return 
1;
}


forward FuncionVida();
public 
FuncionVida()
{
    new 
Float:health;
    for(new 
i;i<MAX_PLAYERS;i++)
    {
        new 
funcionvidaa[i] = SetTimerEx("FuncionVida",1000,true,"i",playerid);
        if(
IsPlayerConnected(i)) // Verifica que el jugador esté conectado y logeado
    
{
    
GetPlayerHealth(ihealth); //Estableciendo el valor flotante health con GetPlayerHealth
    
if(health && < 95)
    { 
//Si su vida es mayor a 0...
        
SetPlayerHealth(ihealth+5); //Da +5 de vida al jugado
    
}
    if(
health 95)
    {
        
KillTimer(funcionvidaa[i])
    }
    return 
1;

Lokii is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
error 017: undefined symbol,fatal error 107: too many error messages on one line Slicebook Scripting Help 11 04/05/2014 08:30 PM
An error has occured. (Error ID: 1064, You have an error in your SQL syntax; check the manual that corresponds.... rati555 Scripting Help 1 14/09/2012 07:45 PM
Registered plate stock error 'error 076: syntax error in the expression, or invalid function call' Deal-or-die Scripting Help 2 25/06/2012 03:12 PM
Error message: : error 030: compound statement not closed at the end of file (started at line 503) David5290 Scripting Help 5 13/04/2012 03:50 AM
I get tagmismatch error, But i cant find any error error Swiftz Help Archive 1 16/04/2011 04:31 AM


All times are GMT. The time now is 06:13 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.