SA-MP Forums Archive
Boost level - 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: Boost level (/showthread.php?tid=557134)



Boost level - kalanerik99 - 12.01.2015

Hello
I don't know whats the problem?
If I type /blevel 2 it blows me away like feather in thunder. WHY
But I have got this line under onplayerconnect setted to 2
Код:
PlayerInfo[playerid][Boostlevel] = 2;
Command:
Код:
CMD:blevel(playerid,params[])
{
#pragma unused params
new level;
if(sscanf(params, "u", level)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /blevel [0.0-10.0]");
PlayerInfo[playerid][Boostlevel] = params[0];
return 1;
}
And I have got this line under onplayerkeystatechange
Код:
if(newkeys & KEY_SUBMISSION)
{
if(PlayerInfo[playerid][Boost] == 1)
{
new Float:vx,Float:vy,Float:vz;
GetVehicleVelocity(GetPlayerVehicleID(playerid),vx,vy,vz);
SetVehicleVelocity(GetPlayerVehicleID(playerid), vx * PlayerInfo[playerid][Boostlevel], vy *PlayerInfo[playerid][Boostlevel], vz * PlayerInfo[playerid][Boostlevel]);
}
}
}



Re: Boost level - RedFusion - 12.01.2015

Try something lower like 1.1 and see what happens.


Re: Boost level - Divergent - 12.01.2015

if(sscanf(params, "u", level))

"u" is the parameter for playerids.

i = integer
d = decimal

so
Код:
if(sscanf(params, "d", level))
Will work properly.


Re: Boost level - kalanerik99 - 13.01.2015

Now it works thanks

But how to make that player could enter like 10.0 (that it wont say /blevel [0.0-10.0])?

Code

Код:
CMD:blevel(playerid,params[])
{
#pragma unused params
new level;
if(sscanf(params, "d", level)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /blevel [0.0-10.0]");
PlayerInfo[playerid][Boostlevel] = level;
return 1;
}



Re: Boost level - Threshold - 13.01.2015

pawn Код:
CMD:blevel(playerid,params[])
{
    new Float:level;
    if(sscanf(params, "f", level)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /blevel [0.0-10.0]");
    PlayerInfo[playerid][Boostlevel] = level;
    return 1;
}
You will need to change 'Boostlevel' in your enum to 'Float:Boostlevel'.


Re: Boost level - kalanerik99 - 13.01.2015

Thanks


Re: Boost level - kalanerik99 - 13.01.2015

But it blows me away as feather again if I use "f"


Re: Boost level - Threshold - 13.01.2015

Then the boost level is too high.


Re: Boost level - kalanerik99 - 13.01.2015

nope I give it 1.8 and the same even 0.1


Re: Boost level - Threshold - 13.01.2015

That's 180% as fast as you were going. Try something smaller.