Can some one make a /car [Name/ID] command?
#9

Quote:
Originally Posted by Stinged
Посмотреть сообщение
Actually sscanf is the best option, but without creating a wasteful array (params is already there)
strval returns 0 if the string is "0" or the string is null. How will he know which is which?

It can be done with sscanf like this:
Код:
new modelid;
if (!sscanf(params, "i", modelid))
{
	// The player entered an ID, check if it's a valid one (between 400 and 611)
	return 1;
}
// The player entered a string (Even if it's null)
if (isnull(params))
	return SendClientMessage(playerid, -1, "Usage: ...");

// Checking if params is a valid vehicle name here, and then setting "modelid" to the model id.
If I've corretly undertsood; he wants make a cmd like /v [name OR vehicleid]
So yes, he can use sscanf; My bad.
Reply


Messages In This Thread
Can some one make a /car [Name/ID] command? - by Gotham - 29.09.2016, 11:36
Re: Can some one make a /car [Name/ID] command? - by Dayrion - 29.09.2016, 11:44
Re: Can some one make a /car [Name/ID] command? - by Gotham - 29.09.2016, 11:46
Re: Can some one make a /car [Name/ID] command? - by Dayrion - 29.09.2016, 11:50
Re: Can some one make a /car [Name/ID] command? - by Gotham - 29.09.2016, 11:58
Re: Can some one make a /car [Name/ID] command? - by Dayrion - 29.09.2016, 12:30
Re: Can some one make a /car [Name/ID] command? - by Quinncell - 29.09.2016, 17:24
Re: Can some one make a /car [Name/ID] command? - by Stinged - 29.09.2016, 17:38
Re: Can some one make a /car [Name/ID] command? - by Dayrion - 29.09.2016, 19:16
Re: Can some one make a /car [Name/ID] command? - by Gotham - 30.09.2016, 13:53

Forum Jump:


Users browsing this thread: 1 Guest(s)