29.09.2016, 17:38
Quote:
Yes probably but there you don't need sscanf because you will switch between integer or string.
You will need Isnull to check if the params is null (https://sampwiki.blast.hk/wiki/Isnull). You will need to check if it's an integer or not (https://sampwiki.blast.hk/wiki/Strval). |
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.