Crouch at deadbody - 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: Crouch at deadbody (
/showthread.php?tid=480579)
Crouch at deadbody -
Lorenzosdm - 11.12.2013
So i'm making a TeaBag system in my GM only its not working when i press C at a player dead body its doing nothing.
Here the script:
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (newkeys & KEY_CROUCH)
{
if(IsPlayerInRangeOfPoint(playerid, 2.0, DX[playerid], DY[playerid], DZ[playerid]) && pInfo[playerid][Teabag] == 1)
{
GivePlayerScore(playerid, 1);
pInfo[playerid][credits] += 1;
SendClientMessage(playerid, -1,"[TEABAG]: You received 1 Score + Credit for a teabagg");
}
return 1;
}
If someone seeing what i'm doing wrong and can help me thank you for that.
Re: Crouch at deadbody -
PrivatioBoni - 11.12.2013
For the "isplayerinrangeofpoint", you should be checking the range of point to the player you're doing it to, not the distance to playerid (yourself)
Re: Crouch at deadbody -
Lorenzosdm - 11.12.2013
You mean like this:
pawn Код:
foreach(Player, i)
{
if(IsPlayerInRangeOfPoint(playerid, 2.0, DX[i], DY[i], DZ[i]) && pInfo[i][Teabag] == 1)
Re: Crouch at deadbody -
PrivatioBoni - 11.12.2013
That is correct, providing that your symbol is in fact "i" obviously.
Re: Crouch at deadbody -
Lorenzosdm - 11.12.2013
Well i tested it and its still not working
Re: Crouch at deadbody -
PrivatioBoni - 11.12.2013
Please define not working. What is not working? Any errors in the code? What happens in-game? (e.g. when you say it's "doing nothing", do you also mean that there isn't even a message, and that your pInfos aren't being updated?)
These details are important and without them it is more difficult to fix your issue.
Re: Crouch at deadbody -
Lorenzosdm - 11.12.2013
Sorry, Well if i am in-game and i kill someone and i press the key C while im standing on his body there happends nothing no message, no credits and no score. In Pawno i have no any warning
Re: Crouch at deadbody -
Ada32 - 11.12.2013
Quote:
Originally Posted by Lorenzosdm
Sorry, Well if i am in-game and i kill someone and i press the key C while im standing on his body there happends nothing no message, no credits and no score. In Pawno i have no any warning
|
loop through players, get the closest one, check if he's dead, do whatever
Re: Crouch at deadbody -
Lorenzosdm - 11.12.2013
Thanks for information guys it worked now! +rep