mercredi 20 juillet 2016

Can anyone tell me whats wrong here?

Well, when i am alone on the server, everything works fine.. But when we are 2, or more online
then if i try to /fish, it just come with the message after one second "You pulled your line out of the water"
and it will keep doing that.. I really hope anyone can help me. rep+

This is the timer that will stop fishing if you leave the water

Code:

forward CheckFish();
public CheckFish()
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(!IsPlayerNearWater(i))
        {
                    if(Fishing[i] == 1)
                    {
                SendClientMessage(i, COLOR_GREY, "You pulled your line out of the water.");
                        Fishing[i] = 0;
                        RemovePlayerAttachedObject(i,0);
                        KillTimer(fishtimer[i]);
                    }
                }
        }
        return 1;
}

This is the near water stock..

Code:

stock IsPlayerNearWater(playerid)
{
        static Float:pos[3];
        GetPlayerPos(playerid, pos[0], pos[1], pos[2]);//read positions

        static Float:check_pos[3];
        static Float:angle;

        #define THRESHOLD   20.0
        #define RADIUS          4.0
        if(pos[2] > -20.0 && pos[2] < THRESHOLD)
        {
                for(new i = 0; i < 4; i++)
                {
                check_pos[0] = pos[0] + (RADIUS * floatsin(-angle, degrees));
                    check_pos[1] = pos[1] + (RADIUS * floatcos(-angle, degrees));
                        angle += 90.0;

            MapAndreas_FindZ_For2DCoord(check_pos[0], check_pos[1], check_pos[2]);

                        if(check_pos[2] == 0.0) return true;
                }
        }
        return false;
}

Please tell me if you need more info

Let's block ads! (Why?)



Can anyone tell me whats wrong here?

Aucun commentaire:

Enregistrer un commentaire