Velocity - 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: Velocity (
/showthread.php?tid=364207)
Velocity -
P<3TS - 29.07.2012
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
Re: Velocity -
Sniper Kitty - 30.07.2012
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;
}
Re: Velocity -
maramizo - 30.07.2012
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.
Re: Velocity -
Sniper Kitty - 30.07.2012
There's only one parameter and he never said that he uses sscanf (I don't use sscanf, I use my own custom function.)
Re: Velocity -
maramizo - 30.07.2012
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.
Re: Velocity -
Sniper Kitty - 30.07.2012
Me knows.
Re: Velocity -
P<3TS - 30.07.2012
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 ?