Increasing Health - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Increasing Health (
/showthread.php?tid=123728)
Increasing Health -
sidhu123 - 27.01.2010
Hello! I'm currently working on my gamemode and I've run into a small problem.
I'm trying to script this:
If the player is within a certain distance of a point and presses the [whatever key it may be] key and if they're health is 95% or lower, $2 is taken from them and their health is increased by 5 %.
I have done most of it, but I get 2 errors which are:
C:\Users\Noorie\Desktop\Transporter.pwn(138

: error 017: undefined symbol "IsPlayerInRange"
C:\Users\Noorie\Desktop\Transporter.pwn(1406) : error 030: compound statement not closed at the end of file (started at line 1376)
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
2 Errors.
Can someone please help me fix this?
Thanks!.
http://pastebin.com/m331c79c9
Re: Increasing Health -
sidhu123 - 27.01.2010
Woooooops!
Sorry to piss you off Seif.. But I was looking at the wrong thing (On wiki..)
Now that thats fixed, can you please tell me how to fix the second error?
I haven't really ever used Keys.
Re: Increasing Health -
lolumadd - 27.01.2010
You forgot to add a close your code.
Re: Increasing Health -
sidhu123 - 27.01.2010
Quote:
Originally Posted by lolumadd [cod5server.tk
]
You forgot to add a close your code.
|
Honestly dude, I'm really tired and shyt :P
I've been studying for exams for like 2 weeks straight now, and I'm exhausted..
Wanna tell me where please?
Re: Increasing Health -
mansonh - 27.01.2010
From the code in the pastbin there isn't a } missing, it must be wherever the code is.
Also
How NOT to check for a key
Re: Increasing Health -
sidhu123 - 27.01.2010
Quote:
Originally Posted by mansonh
|
Ou, thanks. I thought It would be " == ".. Anyways, I still haven't found why I'm getting that error
Re: Increasing Health -
Joe Staff - 27.01.2010
Well we can't help since it's in your script, not the provided code.
Re: Increasing Health -
sidhu123 - 27.01.2010
http://pastebin.com/m331c79c9
Theres the code... The error is somewhere in there. I can't give you any more code because the error isn't anywhere else.
Re: Increasing Health -
sidhu123 - 27.01.2010
Anyone?
Re: Increasing Health -
actiwe - 27.01.2010
It should work like that
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys == KEY_FIRE)
{
if(IsPlayerInRangeOfPoint(playerid, RANGE, CORDX, CORDY, CORDZ))
{
new Float:health;
GetPlayerHealth(playerid, health);
if(health <=95)
{
SetPlayerHealth(playerid, health + 5);
GivePlayerMoney(playerid, -2);
SendClientMessage(playerid, COLOR_LIGHTBLUE, "You've bought a drink for $2");
}
else
{
SendClientMessage(playerid, COLOR_RED, "You still have plenty of health left");
}
return 1;
}
}
return 1;
}