#1

PHP код:
CMD:ssb(playerid,params[])
{
  new 
boost;
  new 
strBoostMultiplier[256];
  new 
strTempString[267];
  if(
sscanf(params,"f",boost))
  {
            
SendClientMessage(playeridCOLOR_MESSAGE_YELLOW"** Usage: /setspeedboost <SpeedBoostMultiplier>");
            
SendClientMessage(playeridCOLOR_MESSAGE_YELLOW"*  Allows you to set the speed boost multiplier that is applied when you press the horn key.");
            
SendClientMessage(playeridCOLOR_MESSAGE_YELLOW"*  Accepted speed boost multiplier values are between 1.0 and 3.0");
            
SendClientMessage(playeridCOLOR_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(playeridCOLOR_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(playeridCOLOR_MESSAGE_YELLOWstrTempString);
          
return 
1;

When i type /ssb 1.0 it show me

PHP код:
Sorryyou must enter a speed boost multiplier between 1.0 and 3.0 
Reply
#2

Код:
new Float:boost;
Reply
#3

PHP код:
CMD:ssb(playerid,params[]) 

  new 
Float:boost
  new 
strBoostMultiplier[256]; 
  new 
strTempString[267]; 
  if(
sscanf(params,"f",boost)) 
  { 
            
SendClientMessage(playeridCOLOR_MESSAGE_YELLOW"** Usage: /setspeedboost <SpeedBoostMultiplier>"); 
            
SendClientMessage(playeridCOLOR_MESSAGE_YELLOW"*  Allows you to set the speed boost multiplier that is applied when you press the horn key."); 
            
SendClientMessage(playeridCOLOR_MESSAGE_YELLOW"*  Accepted speed boost multiplier values are between 1.0 and 3.0"); 
            
SendClientMessage(playeridCOLOR_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(playeridCOLOR_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(playeridCOLOR_MESSAGE_YELLOWstrTempString); 
           
return 
1

Reply
#4

PHP код:
CMD:ssb(playerid,params[])
{
  new 
Float:boost;
  new 
strTempString[267];
  if(
sscanf(params,"f",boost))
  {
            
SendClientMessage(playeridCOLOR_MESSAGE_YELLOW"** Usage: /setspeedboost <SpeedBoostMultiplier>");
            
SendClientMessage(playeridCOLOR_MESSAGE_YELLOW"*  Allows you to set the speed boost multiplier that is applied when you press the horn key.");
            
SendClientMessage(playeridCOLOR_MESSAGE_YELLOW"*  Accepted speed boost multiplier values are between 1.0 and 3.0");
            
SendClientMessage(playeridCOLOR_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(playeridCOLOR_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(playeridCOLOR_MESSAGE_YELLOWstrTempString);
          
return 
1;

Ingame when i type /ssb 1.1 it show me 1.10
Reply
#5

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)