SA-MP Forums Archive
SetCarHealth? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: SetCarHealth? (/showthread.php?tid=180912)



SetCarHealth? - Face9000 - 03.10.2010

Hi all,how to set a car health by a command?

Example: /setcarhealth 0-100

Thanks


Re: SetCarHealth? - LarzI - 03.10.2010

Correction: /setcarhealth 0-1000

But look up dcmd (or zcmd - which is faster), by using it, it's easy to make commands with parameters.

https://sampwiki.blast.hk/wiki/Fast_Commands


Re: SetCarHealth? - Face9000 - 03.10.2010

I dont use dcmd or zcmd


Re: SetCarHealth? - Mike_Peterson - 03.10.2010

Then, either go use it or use strtok + strval
zcmd + sscanf is fastest even though i'd rather
dcmd + sscanf since dcmd is just a line and zcmd a include/plugin (dno)
strcmp + strtok = hmm... a long alternative.


Re: SetCarHealth? - LarzI - 03.10.2010

zcmd is an include, correct.
dcmd takes up more space in the script, so I can't see why you choose dcmd before zcmd, when it's less job using zcmd and it doesn't take extra space in your script.

Oh well, if you don't wanna learn dcmd/zcmd, use strtok or something.
And btw, no need for sscanf when in need of only one parameter, isnull is more than enough


Re: SetCarHealth? - MadeMan - 03.10.2010

Quote:
Originally Posted by Logitech90
Посмотреть сообщение
I dont use dcmd or zcmd
What do you use then?


Re: SetCarHealth? - Calgon - 03.10.2010

Quote:
Originally Posted by Mike_Peterson
Посмотреть сообщение
Then, either go use it or use strtok + strval
zcmd + sscanf is fastest even though i'd rather
dcmd + sscanf since dcmd is just a line and zcmd a include/plugin (dno)
strcmp + strtok = hmm... a long alternative.
Ignorance is bliss.

zcmd is easier to use in comparison to dcmd. You don't need to calculate the length of a command name, have a lengthy OnPlayerCommandText to declare your commands or anything. You just need to include zcmd and create a command like so:

pawn Код:
CMD:lol(playerid, params[]) {
   return 1;
}



Re: SetCarHealth? - Mike_Peterson - 03.10.2010

I know Zcmd is better then dcmd but when ur used to dcmd its easier, but zcmd isnt a big difference.... replace dcmd_ into CMD: so idont get it why i aint using it xD
since short i begin using sscanf, before i always used strval


Re: SetCarHealth? - Face9000 - 03.10.2010

Quote:
Originally Posted by MadeMan
Посмотреть сообщение
What do you use then?
The normal command code..

Код:
    if(strcmp(cmdtext, "/command", true) == 0)
    {
    ETC
    return true;
    }



Re: SetCarHealth? - MadeMan - 03.10.2010

You can't make this command with only strcmp.

You need to learn how to make a command with parameters.

https://sampwiki.blast.hk/wiki/Fast_Commands