makepremium command?
#3

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:
Код:
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
     }
}
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.
Reply


Messages In This Thread
makepremium command? - by VanillaRain - 05.08.2015, 16:50
Re: makepremium command? - by SpikeSpigel - 05.08.2015, 17:10
Re: makepremium command? - by HazardouS - 05.08.2015, 17:12
Re: makepremium command? - by VanillaRain - 05.08.2015, 17:13
Re: makepremium command? - by VanillaRain - 05.08.2015, 17:18
Re: makepremium command? - by HazardouS - 05.08.2015, 17:25
Re: makepremium command? - by VanillaRain - 05.08.2015, 17:27
Re: makepremium command? - by HazardouS - 05.08.2015, 17:31
Re: makepremium command? - by VanillaRain - 05.08.2015, 17:35
Re: makepremium command? - by HazardouS - 05.08.2015, 17:37

Forum Jump:


Users browsing this thread: 1 Guest(s)