Crouch at deadbody
#1

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

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

You mean like this:

pawn Код:
foreach(Player, i)
        {
        if(IsPlayerInRangeOfPoint(playerid, 2.0, DX[i], DY[i], DZ[i]) && pInfo[i][Teabag] == 1)
Reply
#4

That is correct, providing that your symbol is in fact "i" obviously.
Reply
#5

Well i tested it and its still not working
Reply
#6

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

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

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

Thanks for information guys it worked now! +rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)