[help] /bonnet not working on my cmd
#2

Why are you using strtok + strcmp method? It's horribly slow! Here's an example of using ZCMD (which will remove the use of strtok all together)
pawn Код:
COMMAND:bonnet( playerid, params[ ] )
{
   if( isnull( params ) ) return SendClientMessage( playerid, COLOR_GREY: "USAGE: /bonnet [open, close]" );
   if( !strcmp( params, "open", true ) )
   {
      if( GetPlayerState( playerid ) == 1 ) tmpcar = GetClosestCar( playerid );
      if( GetDistanceToCar( playerid, tmpcar ) <= 4 )
      {
         new engline, lights, alarm, doors, bonnet, boot, objective;
         GetVehicleParamsEx( tmpcar, engine, lights, alarm, doors, bonnet, boot, objective );
         SetVehicleParamsEx( tmpcar, engine, lights, alarm, doors, VEHICLE_PARAMS_ON, boot, objective );
         // ...
      }
   }
   else if( !strcmp( params, "close", true ) )
   {
      // .. close the bonnet
   }
   return 1;
}
If you're going to be using more than one parameter, look into the use of sscanf.
Reply


Messages In This Thread
[help] /bonnet not working on my cmd - by tony_fitto - 07.08.2011, 00:37
Re: [help] /bonnet not working on my cmd - by Grim_ - 07.08.2011, 01:11
Re: [help] /bonnet not working on my cmd - by tony_fitto - 07.08.2011, 17:39

Forum Jump:


Users browsing this thread: 1 Guest(s)