SA-MP Forums Archive
Leg broken system +rep - 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: Leg broken system +rep (/showthread.php?tid=620303)



Leg broken system +rep - DemME - 28.10.2016

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?


Re: Leg broken system +rep - iLearner - 28.10.2016

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


Re: Leg broken system +rep - ISmokezU - 28.10.2016

Код:
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


Re: Leg broken system +rep - DemME - 28.10.2016

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?


Re: Leg broken system +rep - iLearner - 28.10.2016

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.");
}
      } 



Re: Leg broken system +rep - DemME - 28.10.2016

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.


Re: Leg broken system +rep - iLearner - 28.10.2016

Show me where you defined plegbroken.


Re: Leg broken system +rep - DemME - 28.10.2016

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


Re: Leg broken system +rep - Konstantinos - 28.10.2016

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


Re: Leg broken system +rep - DemME - 28.10.2016

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?