Velocity
#1

This is command to jump hight, when a player type /jump it will enable and disable when he type it again.
In this cmd Player Velocity is set to be 1.0. I want to make a cmd like /jumpvelocity to set the player velocity to 2.0, 3.0, 4.0 and so on, at the same time it should work when he press jump button(i mean player should jump high when he press "Jump Button" according to the velocity which is set by the cmd /jumpvlocity).


pawn Код:
CMD:jump(playerid,params[]) {
    if(HJump[playerid])
    {
    HJump[playerid] = 0; //will enable boast
    SendClientMessage(playerid, green, "You have Disabled High Jump.");

    }
    else
    {
    HJump[playerid] = 1; //will enable boast
    SendClientMessage(playerid, green, "You have Enabled High Jump.");

    }
    return 1;
    }
pawn Код:
if (newkeys & KEY_JUMP)
    {
        if(HJump[playerid] == 1) {
            SetPlayerVelocity(playerid,0.0,0.0,1.0);
    }}
How to make? please anyone help..i will rep
Reply
#2

pawn Код:
new Float: HJump[MAX_PLAYERS];

CMD:jumpvelocity(playerid, params[]) {
    if(HJump[playerid] != 0.0) {
        HJump[playerid] = 0.0;
        SendClientMessage(playerid, green, "You have Disabled High Jump.");
    }
    else {
        if(! strlen(params) || floatstr(params) <= 0.0) {
            SendClientMessage(playerid, red, "Incorrect syntax: /jumpvelocity <Velocity>");
        }
       
        HJump[playerid] = floatstr(params);
        SendClientMessage(playerid, green, "You have Enabled High Jump.");
    }
    return true;
}

OnPlayerKeyStateChange(playerid, newkeys, oldkeys) {
    if(newkeys & KEY_JUMP) {
        if(HJump[playerid] != 0.0) {
            SetPlayerVelocity(playerid, 0.0, 0.0, HJump[playerid]);
        }
    }
    return true;
}
Reply
#3

Quote:
Originally Posted by Sniper Kitty
Посмотреть сообщение
pawn Код:
new Float: HJump[MAX_PLAYERS];

CMD:jumpvelocity(playerid, params[]) {
    if(HJump[playerid] != 0.0) {
        HJump[playerid] = 0.0;
        SendClientMessage(playerid, green, "You have Disabled High Jump.");
    }
    else {
        if(! strlen(params) || floatstr(params) <= 0.0) {
            SendClientMessage(playerid, red, "Incorrect syntax: /jumpvelocity <Velocity>");
        }
       
        HJump[playerid] = floatstr(params);
        SendClientMessage(playerid, green, "You have Enabled High Jump.");
    }
    return true;
}

OnPlayerKeyStateChange(playerid, newkeys, oldkeys) {
    if(newkeys & KEY_JUMP) {
        if(HJump[playerid] != 0.0) {
            SetPlayerVelocity(playerid, 0.0, 0.0, HJump[playerid]);
        }
    }
    return true;
}
floatstr, instead of using sscanf...
Sir, you are a legend.
Reply
#4

There's only one parameter and he never said that he uses sscanf (I don't use sscanf, I use my own custom function.)
Reply
#5

Quote:
Originally Posted by Sniper Kitty
Посмотреть сообщение
There's only one parameter and he never said that he uses sscanf (I don't use sscanf, I use my own custom function.)
I was not making fun.
Reply
#6

Me knows.
Reply
#7

But now i have to use /jumpvelocity to disable and enable it.I need it in separate cmds like if you type /hjump to disable/enable it and /jumpvelocity to set the velocity.How ?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)