Leg broken system +rep
#1

Howdy, so I'm trying to build a system like LS-RP has that once you get a shot in one of your legs, or both of them you will not walk properly, I found it quite useful when I played there, so here is a picture of the error:

http://imgur.com/a/7bvUh

And here is the full code:

Quote:

public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
if(issuerid != INVALID_PLAYER_ID || weaponid == 22 || weaponid == 23 || weaponid == 24 || weaponid == 25 || weaponid == 26 || weaponid == 27 || weaponid == 28 || weaponid == 29 || weaponid == 30 || weaponid == 31 || weaponid == 32 || weaponid == 33 || weaponid == 34 || weaponid == 35 || weaponid == 36 || weaponid == 37 || weaponid == 38
&& bodypart == 7 || bodypart == 8)
{
if(pLegBroken[playerid] == false)
{
pLegBroken[playerid] = true;
ApplyAnimation(playerid, "PED", "CLIMB_jump2fall", 4.1, 1, 0, 0, 1, 0);
SendClientMessage(playerid, COLOR_LIGHTRED, "-> You've been hit in the leg, you're going to struggle with running and jumping.");
}
}
return 1;
}
What am I missing? could you help me out please?
Reply
#2

I guess after (issuerid != INVALID_PLAYER_ID you need && and not ||
Also your error isn't visible post it here.
Reply
#3

Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
if(issuerid != INVALID_PLAYER_ID return 0;
switch(weaponid){
case 22..38
}
if(bodypart == 7 || bodypart == 8)
Could you break it down a bit
Reply
#4

Quote:
Originally Posted by ISmokezU
Посмотреть сообщение
Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
if(issuerid != INVALID_PLAYER_ID return 0;
switch(weaponid){
case 22..38
}
if(bodypart == 7 || bodypart == 8)
Could you break it down a bit
I still don't get it, could you please elaborate some more?
Reply
#5

PHP код:
public OnPlayerTakeDamage(playeridissueridFloatamountweaponidbodypart)
{
    if(
issuerid != INVALID_PLAYER_ID && weaponid >= 22 && weaponid <=38 && bodypart == || bodypart == 8)
      {
           if(
pLegBroken[playerid] == false)
{
pLegBroken[playerid] = true;
ApplyAnimation(playerid"PED""CLIMB_jump2fall"4.110010);
SendClientMessage(playeridCOLOR_LIGHTRED"-> You've been hit in the leg, you're going to struggle with running and jumping.");
}
      } 
Reply
#6

Quote:
Originally Posted by iLearner
Посмотреть сообщение
I guess after (issuerid != INVALID_PLAYER_ID you need && and not ||
Also your error isn't visible post it here.
The errors marked in red label, you can see it it's on sublime text editor, and I did an arrow in the line.

Quote:
Originally Posted by iLearner
Посмотреть сообщение
PHP код:
public OnPlayerTakeDamage(playeridissueridFloatamountweaponidbodypart)
{
    if(
issuerid != INVALID_PLAYER_ID && weaponid >= 22 && weaponid <=38 && bodypart == || bodypart == 8)
      {
           if(
pLegBroken[playerid] == false)
{
pLegBroken[playerid] = true;
ApplyAnimation(playerid"PED""CLIMB_jump2fall"4.110010);
SendClientMessage(playeridCOLOR_LIGHTRED"-> You've been hit in the leg, you're going to struggle with running and jumping.");
}
      } 
Still the same errors by somehow.
Reply
#7

Show me where you defined plegbroken.
Reply
#8

Quote:
Originally Posted by iLearner
Посмотреть сообщение
Show me where you defined plegbroken.
on " enum playerData { "
Reply
#9

Add it in the enum of PlayerData aray and then:
pawn Код:
PlayerData[playerid][pLegBroken] = true;
Note that you should include bool: tag.
Reply
#10

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Add it in the enum of PlayerData aray and then:
pawn Код:
PlayerData[playerid][pLegBroken] = true;
Note that you should include bool: tag.
I have this bool already, and now I've set it back in the PlayerData, now I've tried to put the line you gave me too, and it occurs the same error, maybe I've set the " PlayerData[playerid][pLegBroken] = true; " at the wrong place?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)