Speed - 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: Speed (
/showthread.php?tid=614617)
Speed -
Loinal - 10.08.2016
PHP код:
CMD:ssb(playerid,params[])
{
new boost;
new strBoostMultiplier[256];
new strTempString[267];
if(sscanf(params,"f",boost))
{
SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, "** Usage: /setspeedboost <SpeedBoostMultiplier>");
SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, "* Allows you to set the speed boost multiplier that is applied when you press the horn key.");
SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, "* Accepted speed boost multiplier values are between 1.0 and 3.0");
SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, "* The shortcut for this command is: /ssb");
return 1;
}
new Float:BoostMultiplier = floatstr(strBoostMultiplier);
// Check speed boost multiplier is not too high or low
if (boost < 1.0 || boost > 3.0)
{
// Send message and exit here
SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, "* Sorry, you must enter a speed boost multiplier between 1.0 and 3.0");
return 1;
}
SpeedBoostMultiplier[playerid] = boost;
format(strTempString,sizeof(strTempString), "* You set your speed boost multiplier to %0.2f", SpeedBoostMultiplier[playerid]);
SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, strTempString);
return 1;
}
When i type /ssb 1.0 it show me
PHP код:
* Sorry, you must enter a speed boost multiplier between 1.0 and 3.0
Re: Speed -
AbyssMorgan - 10.08.2016
Re: Speed -
Luicy. - 10.08.2016
PHP код:
CMD:ssb(playerid,params[])
{
new Float:boost;
new strBoostMultiplier[256];
new strTempString[267];
if(sscanf(params,"f",boost))
{
SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, "** Usage: /setspeedboost <SpeedBoostMultiplier>");
SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, "* Allows you to set the speed boost multiplier that is applied when you press the horn key.");
SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, "* Accepted speed boost multiplier values are between 1.0 and 3.0");
SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, "* The shortcut for this command is: /ssb");
return 1;
}
new Float:BoostMultiplier = floatstr(strBoostMultiplier);
// Check speed boost multiplier is not too high or low
if (boost =< 1.0 || boost >= 3.0)
{
// Send message and exit here
SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, "* Sorry, you must enter a speed boost multiplier between 1.0 and 3.0");
return 1;
}
SpeedBoostMultiplier[playerid] = boost;
format(strTempString,sizeof(strTempString), "* You set your speed boost multiplier to %0.2f", SpeedBoostMultiplier[playerid]);
SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, strTempString);
return 1;
}
Re: Speed -
Loinal - 18.08.2016
PHP код:
CMD:ssb(playerid,params[])
{
new Float:boost;
new strTempString[267];
if(sscanf(params,"f",boost))
{
SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, "** Usage: /setspeedboost <SpeedBoostMultiplier>");
SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, "* Allows you to set the speed boost multiplier that is applied when you press the horn key.");
SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, "* Accepted speed boost multiplier values are between 1.0 and 3.0");
SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, "* The shortcut for this command is: /ssb");
return 1;
}
/* new Float:BoostMultiplier = floatstr(boost);*/
// Check speed boost multiplier is not too high or low
if (boost < 1.0 || boost > 3.0)
{
// Send message and exit here
SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, "* Sorry, you must enter a speed boost multiplier between 1.0 and 3.0");
return 1;
}
SpeedBoostMultiplier[playerid] = boost;
format(strTempString,sizeof(strTempString), "* You set your speed boost multiplier to %0.2f", SpeedBoostMultiplier[playerid]);
SendClientMessage(playerid, COLOR_MESSAGE_YELLOW, strTempString);
return 1;
}
Ingame when i type /ssb 1.1 it show me 1.10
Re: Speed -
WrathOfGenesis - 19.08.2016
That's the same value
You can use %X.Yf where X is the number of places before the dot, while Y is the places after it
0.1 becomes 0.100 with ℅01.03f
0.1738838 becomes 0.2 with ℅01.01f
And so on