05.08.2015, 17:12
You have to extract the "user" param from the "params" string. For this, since you're already using ZCMD, I'd recommend installing (or using, if you have already installed it) SSCANF: https://sampforum.blast.hk/showthread.php?tid=570927 .
Use the "u" specifier, so you'll get something like this:
All you have to do is understand this code, maybe rewrite it to look better and merge it with your command and you're good to go.
Also, some off-topic note: saving data in files (dini) is outdated, consider moving to a database saving system.
Use the "u" specifier, so you'll get something like this:
Код:
new targetID; if(sscanf(params, "u", targetID)) { //the admin didn't respect the syntax (he didn't write [/makepremium <player>]) } else { //a value has been set to the targetID variable, but it can be either valid (player found) or invalid (player not found) if(!IsPlayerConnected(targetID)) { //target player is not connected } else { //target player is connected and ready to receive the Premium status, insert all your messages and stuff here } }
Also, some off-topic note: saving data in files (dini) is outdated, consider moving to a database saving system.