How can i make a cmd with optional options?
#3

PHP код:
new giveplayeridfloat:health;
if(
sscanf(params"uF"giveplayeridhealth))
{
    
SetPlayerHealth(giveplayeridhealth);

Using sscanf you format the input, your first exception is your input, then it's your format and then it's the variables you store to.

If we wanted to make it so that you HAD TO enter a health amount, the format would be "uf" for User and Float, however, because the amount is optional, it is "uF", capitalising the letter tells it that it's an optional check. (never made an optional float before, but I'm presuming it works the same as an integer :P)
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)