Where to put this? - 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: Where to put this? (
/showthread.php?tid=284080)
Where to put this? -
Da' J' - 17.09.2011
Where i should put this code in my script? Under which parameter, or where? Helpz
pawn Код:
GetPlayerHealth(playerid,health);
if(health <= 29)
{
ApplyAnimationEx(playerid, "CRACK", "crckdeth2", 4.0, 0, 1, 1, 1, 1);
return 1;
}
Re: Where to put this? -
[HiC]TheKiller - 17.09.2011
You would probably have to put that under a timer or a callback that sets your health lower. All that does is applies a animation, not kills the player. Also, if you are copy and pasting out of other scripts, don't do that, it ends up screwing up your code.
Re: Where to put this? -
[MG]Dimi - 17.09.2011
I would say it goes under OnPlayerUpdate
Re: Where to put this? -
Xyrex - 17.09.2011
Listen to Dimi, you must put this under OnPlayerUpdate.
Re: Where to put this? -
[MG]Dimi - 17.09.2011
Yeah. Only problem is that it will be called every time he changes his health to less than 29 which can be 5+ times before he dies
Re: Where to put this? -
Da' J' - 17.09.2011
Ok so i threw the code to somewhere where was talking about when your health increases. (Cluckin bell etc.) Just under all that. Well i get these errors:
pawn Код:
E:\SA-MP Offical Server\gamemodes\B-RP.pwn(6648) : error 010: invalid function or declaration
E:\SA-MP Offical Server\gamemodes\B-RP.pwn(6650) : warning 218: old style prototypes used with optional semicolumns
E:\SA-MP Offical Server\gamemodes\B-RP.pwn(6651) : error 010: invalid function or declaration
E:\SA-MP Offical Server\gamemodes\B-RP.pwn(45421) : warning 203: symbol is never used: "gCopPlayerSpawns"
E:\SA-MP Offical Server\gamemodes\B-RP.pwn(45421) : warning 203: symbol is never used: "gMedPlayerSpawns"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
2 Errors.
Edit: And under OnPlayerUpdate (have tried earlier) it throws up this:
pawn Код:
E:\SA-MP Offical Server\gamemodes\B-RP.pwn(11468) : error 021: symbol already defined: "GetPlayerHealth"
E:\SA-MP Offical Server\gamemodes\B-RP.pwn(11469) : error 010: invalid function or declaration
E:\SA-MP Offical Server\gamemodes\B-RP.pwn(11471) : warning 218: old style prototypes used with optional semicolumns
E:\SA-MP Offical Server\gamemodes\B-RP.pwn(11472) : error 010: invalid function or declaration
E:\SA-MP Offical Server\gamemodes\B-RP.pwn(45421) : warning 203: symbol is never used: "gCopPlayerSpawns"
E:\SA-MP Offical Server\gamemodes\B-RP.pwn(45421) : warning 203: symbol is never used: "gMedPlayerSpawns"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
3 Errors.
Re: Where to put this? -
Xyrex - 17.09.2011
You are right, It can be solved with a boolean variable.
pawn Код:
public OnPlayerUpdate(playerid)
{
if(booleanvaribale){
if(health <= 29) {
ApplyAnimationEx(playerid, "CRACK", "crckdeth2", 4.0, 0, 1, 1, 1, 1);
booleanvariable = false;
}
}
}
Re: Where to put this? -
JiHost - 17.09.2011
Quote:
Originally Posted by [MG]Dimi
I would say it goes under OnPlayerUpdate
|
Do NOT put it under OnPlayerUpdate. This callback is called very frequently per second per player. It will lag your server. There are timers for such functions...
Re: Where to put this? -
=WoR=Varth - 17.09.2011
Quote:
Originally Posted by JiHost
Do NOT put it under OnPlayerUpdate. This callback is called very frequently per second per player. It will lag your server. There are timers for such functions...
|
It isn't per player per second. More than that.
Re: Where to put this? -
=WoR=Bruno - 17.09.2011
Quote:
Originally Posted by Da' J'
Ok so i threw the code to somewhere where was talking about when your health increases. (Cluckin bell etc.) Just under all that. Well i get these errors:
pawn Код:
E:\SA-MP Offical Server\gamemodes\B-RP.pwn(6648) : error 010: invalid function or declaration E:\SA-MP Offical Server\gamemodes\B-RP.pwn(6650) : warning 218: old style prototypes used with optional semicolumns E:\SA-MP Offical Server\gamemodes\B-RP.pwn(6651) : error 010: invalid function or declaration E:\SA-MP Offical Server\gamemodes\B-RP.pwn(45421) : warning 203: symbol is never used: "gCopPlayerSpawns" E:\SA-MP Offical Server\gamemodes\B-RP.pwn(45421) : warning 203: symbol is never used: "gMedPlayerSpawns" Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
2 Errors.
Edit: And under OnPlayerUpdate (have tried earlier) it throws up this:
pawn Код:
E:\SA-MP Offical Server\gamemodes\B-RP.pwn(11468) : error 021: symbol already defined: "GetPlayerHealth" E:\SA-MP Offical Server\gamemodes\B-RP.pwn(11469) : error 010: invalid function or declaration E:\SA-MP Offical Server\gamemodes\B-RP.pwn(11471) : warning 218: old style prototypes used with optional semicolumns E:\SA-MP Offical Server\gamemodes\B-RP.pwn(11472) : error 010: invalid function or declaration E:\SA-MP Offical Server\gamemodes\B-RP.pwn(45421) : warning 203: symbol is never used: "gCopPlayerSpawns" E:\SA-MP Offical Server\gamemodes\B-RP.pwn(45421) : warning 203: symbol is never used: "gMedPlayerSpawns" Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
3 Errors.
|
did you read this?:
Quote:
Originally Posted by [HiC]TheKiller
f you are copy and pasting out of other scripts, don't do that, it ends up screwing up your code.
|
...
Quote:
Originally Posted by G4M3Ov3r
Put it under a command, if you wanna use em as a cmd
PHP код:
if(strcmp(cmdtext, "/command", true) == 0)
{
new Float:health;
GetPlayerHealth(playerid,health);
if(health <= 29)
{
ApplyAnimationEx(playerid, "CRACK", "crckdeth2", 4.0, 0, 1, 1, 1, 1);
return 1;
}
|
he want a auto crack animation when you reach a certain ammount of health,not a command.