setcarhp command
#2

You use scanf to do this. There are other methods but in most cases you won't need to use them.

You should also use zcmd to make use of the "params[]" it offers.

Below is an example on how to use sscanf in ZCMD :

PHP код:
// Define two variables for sscanf
new vehicleidFloatvehiclehealth ;
// Store our data in the variables with sscanf using "params":
if ( sscanf params"if"vehiclevehiclehealth ) ) {
    
// If params are incorrect, return a error message here

To check if a vehicle ID is valid you do this (inside the same callback you defined the sscanf variables):
PHP код:
if ( ! IsValidVehicleID vehicleid ) ) {
    
// If vehicle is not valid, return error message here

Take a look at these wiki posts for more information (as you are using your specifiers incorrectly):
https://sampwiki.blast.hk/wiki/Control_Structures#Operators
https://sampwiki.blast.hk/wiki/Fast_Commands#Data_types

And the functions that do what you want to do:
https://sampwiki.blast.hk/wiki/IsValidVehicle
https://sampwiki.blast.hk/wiki/SetVehicleHealth

For your error, read the big yellow box at the "IsValidVehicle" wiki page.
Reply


Messages In This Thread
setcarhp command - by XpoZzA - 27.10.2016, 13:38
Re: setcarhp command - by Dignity - 27.10.2016, 13:49

Forum Jump:


Users browsing this thread: 1 Guest(s)