Need help with Error 10. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Need help with Error 10. (
/showthread.php?tid=452238)
Need help with Error 10. -
Edward2013 - 20.07.2013
Hello again

. I want to create Injured System, so here is my code
Код:
//
// SIMPLE INJURED SYSTEM
// BY: EDWARD VELKOV
// FOR SAMP 0.3X
// SERVER: ENERGY ROLEPLAY
// CREATED ON: 20.7.2013
//
//---------------------------------------------------------------//
#include <a_samp>
#include <core>
#include <float>
//--------------------------------------------------------------//
#define TogglePlayerControllable
#define GetPlayerHealth
#define phealth
//-------------------------------------------------------------//
public OnPlayerUpdate(playerid);
GetPlayerHealth(playerid,phealth);
if(phealth < 35)
//fall animation
TogglePlayerControllable(playerid,0);
ApplyAnimation(playerid,"CRACK","crckidle2",1,0,0, 0,0,0);
return 1;
}
..But when I try to compile it, it finds 4 errors -
D:\Games\Grand Theft Auto (GTA) San Andreas-HOODLUM\GTA San Andreas\filterscripts\Anim.pwn(21) : error 010: invalid function or declaration
D:\Games\Grand Theft Auto (GTA) San Andreas-HOODLUM\GTA San Andreas\filterscripts\Anim.pwn(22) : error 010: invalid function or declaration
D:\Games\Grand Theft Auto (GTA) San Andreas-HOODLUM\GTA San Andreas\filterscripts\Anim.pwn(25) : error 010: invalid function or declaration
D:\Games\Grand Theft Auto (GTA) San Andreas-HOODLUM\GTA San Andreas\filterscripts\Anim.pwn(2

: error 010: invalid function or declaration.
Any idea how to fix it?
Re: Need help with Error 10. -
Lordzy - 20.07.2013
pawn Код:
#include <a_samp>
public OnPlayerUpdate(playerid)
{
new Float:phealth;
GetPlayerHealth(playerid, phealth);
if(phealth < 35.0)
{
TogglePlayerControllable(playerid, 0);
ApplyAnimation(playerid, "CRACK", "crckidle2", 1, 0, 0, 0, 0, 0);
}
return 1;
}
Those defines were actually useless, you have that already defined by 'a_samp' include. Secondly ' 'public OnPlayerUpdate' is a callback which uses braces to declare the code under it. You just did it like performing functions. And phealth must be a variable which must be created and also as a 'Float' variable.
Re: Need help with Error 10. -
Edward2013 - 20.07.2013
Quote:
Originally Posted by Lordz™
pawn Код:
#include <a_samp>
public OnPlayerUpdate(playerid) { new Float:phealth; GetPlayerHealth(playerid, phealth); if(phealth < 35.0) { TogglePlayerControllable(playerid, 0); ApplyAnimation(playerid, "CRACK", "crckidle2", 1, 0, 0, 0, 0, 0); } return 1; }
Those defines were actually useless, you have that already defined by 'a_samp' include. Secondly ' 'public OnPlayerUpdate' is a callback which uses braces to declare the code under it. You just did it like performing functions. And phealth must be a variable which must be created and also as a 'Float' variable.
|
Thanks for your help. I will use this in future.