Quick question - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Quick question (
/showthread.php?tid=491275)
Quick question -
EliteApple - 30.01.2014
I've started making a command,
/faction, with several different commands followed after it, such as /faction invite, /faction uninvite, ect.
However, how do I get IDs after I /faction invite?
Example:
/faction invite 13
13 = Player ID.
Re: Quick question -
Shockey HD - 30.01.2014
You can use sscanf.
I will use ZCMD for this:
pawn Код:
CMD:faction(playaerid, params[])
{
new Option[32], ID; // ID will be used for Player ID, Option will be like "Invite" or "uninvite"
if(sscanf(params, "s[32]u", Option, ID))//This is the sscanf statement, s[32] = String using size of 32, u is the id
{
SendClientMessage(playerid, -1, "Usage: /faction [Option] [ID]");
SendClientMessage(playerid, -1, "Options: Invite, Uninvite");//If they don't type the full command these messages will send
}
else
{
if(strcmp(Option, "invite", true) == 0)//If they type invite for option
{
//Invite goes here
}
if(strcmp(Option, "uninvite", true) == 0)//if they type uninvite for the option
{
// Uninvite goes here
SendClientMessage(ID, -1, "Sends message to the ID of the player, Using ID");
}
}
return 1;
}
Re: Quick question -
EliteApple - 30.01.2014
You don't have to use ZCMD as I've done it before in strcmp some how, but okay.
Re: Quick question -
Shockey HD - 30.01.2014
ZCMD tends to be faster including SSCANF, I've only scripted using the two.. so there is that option.
Re: Quick question -
EliteApple - 30.01.2014
I understand, I have alot of commands that are ZCMD, but I for some reason perfer strcmp as thats what I learned when I started, but I'll use ZCMD I guess, I'll get back to you in a moment.
Re: Quick question -
Shockey HD - 30.01.2014
Sure any questions ask away
Re: Quick question -
EliteApple - 30.01.2014
I tried sending you a PM, but couldn't, could you add me on skype?
eliteapple1337