Quick help please
#1

Hi, i'm planning to make something that flings your car forward when it's a range of the point. here is my code.
pawn Код:
forward PipeCheck(playerid);
public PipeCheck(playerid)
{
    SendClientMessageToAll(COLOR_WHITE, "DEBUG: Pipecheck started");
    if(IsPlayerInRangeOfPoint(playerid, 2.5, 1976.7637,-2522.4316,18.6932))
    {
        new Float:vx, Float:vy, Float:vz;
        GetVehicleVelocity(GetPlayerVehicleID(playerid), vx, vy, vz);

        new Float:va;
        GetVehicleZAngle(GetPlayerVehicleID(playerid), va);

        SetVehicleVelocity(GetPlayerVehicleID(playerid), floatsin(-va, degrees) * 0.9, floatcos(va, degrees) * 2.9 , vz);
        SendClientMessageToAll(COLOR_WHITE, "DEBUG: Player has been flunged forward!");
    }
    return 1;
}
It sends the first text but doesn't' sent the second one.
Reply
#2

Have you double-checked your coordinates? Also, how many MS is the timer being set for?
Reply
#3

400 seconds. My coords are correct.
Reply
#4

You may wish to put the timer at a lower milliseconds (higher speed). As it works with velocity, you can't stop at the coordinates - you would have to continue moving. It's getting stuck on your coordinate check, though.. which is very odd.
Reply
#5

Still nothing, just set it to 100.
Reply
#6

That's odd. Try adding a message AFTER the player position check to see if it's really getting stuck on that;

pawn Код:
forward PipeCheck(playerid);
public PipeCheck(playerid)
{
    SendClientMessageToAll(COLOR_WHITE, "DEBUG: Pipecheck started");
    if(IsPlayerInRangeOfPoint(playerid, 2.5, 1976.7637,-2522.4316,18.6932))
    {
        SendClientMessageToAll(COLOR_WHITE, "DEBUG: Passed the Player Coordinate check!");
        new Float:vx, Float:vy, Float:vz;
        GetVehicleVelocity(GetPlayerVehicleID(playerid), vx, vy, vz);
        SendClientMessageToAll(COLOR_WHITE, "DEBUG: Got their velocity!");

        new Float:va;
        GetVehicleZAngle(GetPlayerVehicleID(playerid), va);
        SendClientMessageToAll(COLOR_WHITE, "DEBUG: Got their angle!");

        SetVehicleVelocity(GetPlayerVehicleID(playerid), floatsin(-va, degrees) * 0.9, floatcos(va, degrees) * 2.9 , vz);
        SendClientMessageToAll(COLOR_WHITE, "DEBUG: Player has been flunged forward!");
    }
    return 1;
}
Reply
#7

It seems to keep saying "Pipecheck started"
Reply
#8

At least that narrowed down the problem some, which I already had a hunch was the problem, anyway. I'm really not sure, have you ever done a system like this before? Do you need a pickup or something in that position for it to work?
Reply
#9

I haven't done anything like this before, i'll give it ago though.
Reply
#10

Try the pickup idea, that is pickupable in a vehicle, and put all of that code into OnPlayerPickupPickup rather than a timer. May work better for you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)