SA-MP Forums Archive
SetPlayerVelocity [+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: SetPlayerVelocity [+rep] (/showthread.php?tid=333423)



SetPlayerVelocity [+rep] - mehdi-jumper - 11.04.2012

Hi everybody,

I made an human canon for my freeroam server and i don't know how to make the ejection.
The canon is vertical and I want the player to go on the sky.

My code :
pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
    if(canon[playerid] == true)
    {
        Decompte = SetTimerEx("CountDown", 1000, true,"%d",playerid);
        DisablePlayerCheckpoint(playerid);
    }
    return 1;
}
forward CountDown(playerid);
public CountDown(playerid)
{
     new str[128], Float:x, Float:y, Float:z;

     if(CountDownVar == 0)
     {
            KillTimer(Decompte);
            CountDownVar = 5;
            canon[playerid] = false;
            GetPlayerVelocity(playerid,x,y,z);
            SetPlayerVelocity(playerid,x,y,z+10000000);
     }
     else
     {

           CountDownVar--;
           format(str, sizeof(str), "Lancement dans : %ds", CountDownVar);
           GameTextForPlayer(playerid,str, 900, 0);
     }
}
but the player jump only 2 meters. If I do z*1000000 nothing happend.

Can you help me?

Thanks a lot!


Re: SetPlayerVelocity [+rep] - Cjgogo - 11.04.2012

If it is vertical,why don't you set a timer and when it finishes counting SetPlayerPos(playerid,x,y,z+0.5)


Re : SetPlayerVelocity [+rep] - mehdi-jumper - 11.04.2012

Because I want to make a countdown before the ejection and z+0.5 does nothing, except a small jump (1m)


Re: SetPlayerVelocity [+rep] - Cjgogo - 11.04.2012

So make the countdown vefore ejection,and then make a reapeating countodwn of 1 sec wich will throw player in air 2 metheres?


Re : SetPlayerVelocity [+rep] - mehdi-jumper - 11.04.2012

Okey but how to throw the player in the sky? SetPlayerVelocity(playerid,x,y,z+...); don"t work


Re: SetPlayerVelocity [+rep] - Faisal_khan - 11.04.2012

pawn Код:
SetPlayerPos(playerid,x,y,z+___)
With countdowns and then SetPlayerPos then again countdown ..................


Re: SetPlayerVelocity [+rep] - Cjgogo - 11.04.2012

On the specific timer that is supossed to throw the player up do this,when the timer ends:
pawn Код:
GetPlayerPos(playerid,x,y,z);
SetPlayerPos(playerid,x,y,z+2);
and keep reseting timer to a defined variable like height=0;while the player goes up in sky increase the variable.In the end we may say the variable height it's 10,stop reseting the timer :P


Re : SetPlayerVelocity [+rep] - mehdi-jumper - 11.04.2012

Why SetPlayerPos? I don't want the player be teleported in the sky^^


Re: SetPlayerVelocity [+rep] - Cjgogo - 11.04.2012

If you will make it like z+2,it will seem like he's flying not teleporting,teleporting would be z+ZOMG/HUGE/NUMBER/HERE(to be over 1000 please)


Re : SetPlayerVelocity [+rep] - mehdi-jumper - 11.04.2012

SetPlayerPos= Teleporting

Do you know how to do to make the player fly in the sky or no?