Where to put this?
#1

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;
}
Reply
#2

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.
Reply
#3

I would say it goes under OnPlayerUpdate
Reply
#4

Listen to Dimi, you must put this under OnPlayerUpdate.
Reply
#5

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
Reply
#6

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.
Reply
#7

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;
        }
    }
}
Reply
#8

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...
Reply
#9

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.
Reply
#10

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.001111);
    return 
1;

he want a auto crack animation when you reach a certain ammount of health,not a command.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)