Someone help me with this command please?
#1

Hi. Been a bit stuck on this command for a while, can someone help me out?
pawn Код:
command(points, playerid, params[])
{
    if(sscanf(params,  ""))
    {
        SendClientMessage(playerid, WHITE, "SYNTAX: /points [usage]");
        SendClientMessage(playerid, GREY, "Usages: Buy, Info, Items");
    }
    else
    {
        if(strcmp("Items", true) == 0)
        {
            SendClientMessage(playerid, GREY, "---------------------------------------------------------------------------------------------------------------------------");
            SendClientMessage(playerid, WHITE, "You can buy the following with points.");
            SendClientMessage(playerid, WHITE, "Special Houses (Under Construction, will have a command to explain");
            SendClientMessage(playerid, WHITE, "VIP Levels - 30000 each level (3 levels) | Private slot 40000 | Personal Forum Rank 30000");
            SendClientMessage(playerid, WHITE, "More coming soon! Feel free to suggest to Dr_Dre!");
            SendClientMessage(playerid, GREY, "---------------------------------------------------------------------------------------------------------------------------");
        }
        else if(strcmp("Buy", true) == 0)
        {
            SendClientMessage(playerid, GREY, "---------------------------------------------------------------------------------------------------------------------------");
            SendClientMessage(playerid, WHITE, "5,000 points - Ј1");
            SendClientMessage(playerid, WHITE, "20,000 points - Ј3");
            SendClientMessage(playerid, WHITE, "50,000 points - Ј5");
            SendClientMessage(playerid, WHITE, "100,000 points - Ј8");
            SendClientMessage(playerid, WHITE, "1,000,000 points - Ј20");
            SendClientMessage(playerid, GREY, "---------------------------------------------------------------------------------------------------------------------------");
        }
        else if(strcmp("Info", true) == 0)
        {
            SendClientMessage(playerid, GREY, "---------------------------------------------------------------------------------------------------------------------------");
            SendClientMessage(playerid, WHITE, "The point system is quite a fair one. Instead of paying for your stuff, you could put a lot of effort into gaining them");
            SendClientMessage(playerid, WHITE, "without paying. Obviously, paying is a better method as it's easier to obtain more things. You will gain points for doing");
            SendClientMessage(playerid, WHITE, "certain things. I.e. the reaction test game (word challenge) gives you a point everytime you win it with money. Also, ");
            SendClientMessage(playerid, WHITE, "things like events will give you a few too. We will keep you all updated!");
        }
    }
    return 1;
}
Cookies and Reputation are being given.
EDIT: I know the first thing someone will pick on is "if(sscanf(params, ""))", it's that line I need help with I think.
Код:
C:\Users\JB\Desktop\Callisto Fan Server\gamemodes\dmovie.pwn(20830) : error 035: argument type mismatch (argument 2)
C:\Users\JB\Desktop\Callisto Fan Server\gamemodes\dmovie.pwn(20839) : error 035: argument type mismatch (argument 2)
C:\Users\JB\Desktop\Callisto Fan Server\gamemodes\dmovie.pwn(20849) : error 035: argument type mismatch (argument 2)
Reply
#2

pawn Код:
if(sscanf(params, "s[6]", input)) return SendClientMessage(playerid, 0xFF0000AA, "USAGE: /command [usage]")

if(strcmp(input, "Items", true) == 0)
Reply
#3

pawn Код:
if(strcmp(params,"whatever",false) == 0 )

pawn Код:
IF(StringCompare(VariableToCheck,VariableToCheckAgainst,CapslockSensitive (false = no), == (if return is equals to) 0) 0 = match, 1 = didn't
don't ask my why 0 is true, blame the developers.


EDIT: The above guy is right, I forgot you need to pass params through something before you can check them and he also fixed your sscanf check, just remember to make the variable.
Reply
#4

^ That didn't work. Input isn't defined and a bunch of other crap, lol.
Reply
#5

put in there...above sscanf, new input[6];
Reply
#6

Cheers!
Reply
#7

Sorry, IG all I'm getting is '/points [Items/Buy/Info]'. Anything else?
pawn Код:
command(points, playerid, params[])
{
    new input[6];
    if(sscanf(params, "s[6]", input)) return SendClientMessage(playerid, WHITE, "USAGE: /points [Items/Buy/Info]");
    else
    {
        if(strcmp(input, "Items", true) == 0)
        {
            SendClientMessage(playerid, GREY, "---------------------------------------------------------------------------------------------------------------------------");
            SendClientMessage(playerid, WHITE, "You can buy the following with points.");
            SendClientMessage(playerid, WHITE, "Special Houses (Under Construction, will have a command to explain");
            SendClientMessage(playerid, WHITE, "VIP Levels - 30000 each level (3 levels) | Private slot 40000 | Personal Forum Rank 30000");
            SendClientMessage(playerid, WHITE, "More coming soon! Feel free to suggest to Dr_Dre!");
            SendClientMessage(playerid, GREY, "---------------------------------------------------------------------------------------------------------------------------");
            return 1;
        }
        else if(strcmp(input, "Buy", true) == 0)
        {
            SendClientMessage(playerid, GREY, "---------------------------------------------------------------------------------------------------------------------------");
            SendClientMessage(playerid, WHITE, "5,000 points - Ј1");
            SendClientMessage(playerid, WHITE, "20,000 points - Ј3");
            SendClientMessage(playerid, WHITE, "50,000 points - Ј5");
            SendClientMessage(playerid, WHITE, "100,000 points - Ј8");
            SendClientMessage(playerid, WHITE, "1,000,000 points - Ј20");
            SendClientMessage(playerid, GREY, "---------------------------------------------------------------------------------------------------------------------------");
            return 1;
        }
        else if(strcmp(input, "Info", true) == 0)
        {
            SendClientMessage(playerid, GREY, "---------------------------------------------------------------------------------------------------------------------------");
            SendClientMessage(playerid, WHITE, "The point system is quite a fair one. Instead of paying for your stuff, you could put a lot of effort into gaining them");
            SendClientMessage(playerid, WHITE, "without paying. Obviously, paying is a better method as it's easier to obtain more things. You will gain points for doing");
            SendClientMessage(playerid, WHITE, "certain things. I.e. the reaction test game (word challenge) gives you a point everytime you win it with money. Also, ");
            SendClientMessage(playerid, WHITE, "things like events will give you a few too. We will keep you all updated!");
            return 1;
        }
    }
    return 1;
}
Reply
#8

take out the else and its opening an closing brackets, then select the stuff below it(not the return 1) and press shift+tab once
Reply
#9

also, Might I recommend you make the case sensitive false.
Reply
#10

This should work for you.

pawn Код:
command(points, playerid, params[])
{
    new input[6];
    if(sscanf(params, "s[6]", input))
        return SendClientMessage(playerid, WHITE, "USAGE: /points [Items/Buy/Info]");
   
    if(!strcmp(input, "Items", true))
    {
        SendClientMessage(playerid, GREY, "---------------------------------------------------------------------------------------------------------------------------");
        SendClientMessage(playerid, WHITE, "You can buy the following with points.");
        SendClientMessage(playerid, WHITE, "Special Houses (Under Construction, will have a command to explain");
        SendClientMessage(playerid, WHITE, "VIP Levels - 30000 each level (3 levels) | Private slot 40000 | Personal Forum Rank 30000");
        SendClientMessage(playerid, WHITE, "More coming soon! Feel free to suggest to Dr_Dre!");
        SendClientMessage(playerid, GREY, "---------------------------------------------------------------------------------------------------------------------------");
* * *}
* * *else if(!strcmp(input, "Buy", true))
* * *{
        SendClientMessage(playerid, GREY, "---------------------------------------------------------------------------------------------------------------------------");
        SendClientMessage(playerid, WHITE, "5,000 points - Ј1");
        SendClientMessage(playerid, WHITE, "20,000 points - Ј3");
        SendClientMessage(playerid, WHITE, "50,000 points - Ј5");
        SendClientMessage(playerid, WHITE, "100,000 points - Ј8");
        SendClientMessage(playerid, WHITE, "1,000,000 points - Ј20");
        SendClientMessage(playerid, GREY, "---------------------------------------------------------------------------------------------------------------------------");
    }
    else if(!strcmp(input, "Info", true))
    {
        SendClientMessage(playerid, GREY, "---------------------------------------------------------------------------------------------------------------------------");
        SendClientMessage(playerid, WHITE, "The point system is quite a fair one. Instead of paying for your stuff, you could put a lot of effort into gaining them");
        SendClientMessage(playerid, WHITE, "without paying. Obviously, paying is a better method as it's easier to obtain more things. You will gain points for doing");
        SendClientMessage(playerid, WHITE, "certain things. I.e. the reaction test game (word challenge) gives you a point everytime you win it with money. Also, ");
        SendClientMessage(playerid, WHITE, "things like events will give you a few too. We will keep you all updated!");
* * }
* * return 1;
}
Indentation may be screwed because I'm working on a Mac here...
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)