Quick question
#1

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.
Reply
#2

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;
}
Reply
#3

You don't have to use ZCMD as I've done it before in strcmp some how, but okay.
Reply
#4

ZCMD tends to be faster including SSCANF, I've only scripted using the two.. so there is that option.
Reply
#5

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.
Reply
#6

Sure any questions ask away
Reply
#7

I tried sending you a PM, but couldn't, could you add me on skype?
eliteapple1337
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)