Question on how can I FIX my command
#1

Hello guys,

I got this command:
PHP код:
if(strcmp(cmd"/tlaws"true) == 0// 
    
{
        if(
IsPlayerConnected(playerid))
        {
            
ShowPlayerDialog(playerid,1523,DIALOG_STYLE_MSGBOX,"{FF0000}Traffic Laws{FFFFFF}","\n\
            1. ALWAYS stop to red. You may turn right on red after coming to a full stop if the road is clear.\n\
            2. Civilians have ALWAYS priority,stop and let them pass.\n\
            3. Keep in the Speed limits,in-town limit is 50mp/h and on the high traffic roads is 90-120mp/h\n\
            4. Always Yeld to emegercy vehicles such LSPD,LSFD,they have priority.\n\
            5. ALWAYS drive on the right side of the road."
,"AGREE","");
          }
        return 
1;
    } 
But..i was wondering why everytime i am typing it in-game i get the well known error "Unknown command?".
Actually can you help me fix this?Also i was wondering what does this zero mean?
PHP код:
if(strcmp(cmd"/tlaws"true) == 0
Thank you for reading my post!!


Best regards,
George
Reply
#2

The 0 is the level that a player got to be to use that command .

Probably the problem is on your script . You don't have to use the things there , you are wrong in all of it .

pawn Код:
if(strcmp(cmd, "/tlaws", true) == 0) //  
    {
        if(IsPlayerConnected(playerid))
        {
            ShowPlayerDialog(playerid,1523,DIALOG_STYLE_MSGBOX,"{FF0000}Traffic Laws{FFFFFF}","\n\1. ALWAYS stop to red. You may turn right on red after coming to a full stop if the road is clear.\n2. Civilians have ALWAYS priority,stop and let them pass.\n3. Keep in the Speed limits,in-town limit is 50mp/h and on the high traffic roads is 90-120mp/h\n4. Always Yeld to emegercy vehicles such LSPD,LSFD,they have priority.\n5. ALWAYS drive on the right side of the road.","AGREE","Close");
          }
        return 1;
    }
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(response)// They pressed the first button.
    {
    switch(dialogid)// If you only have one dialog, then this isn't required, but it's neater for when you implement more dialogs.
        {
        case 1523:// Our dialog!
            {
            switch(listitem)// Checking which listitem was selected
            {
                case 0:// The first item listed
                {
                    // Codes here ETC ..
                }
                case 1: // The second item listed
                {
                    // Codes here ETC ..
                }
                case 2: // The third item listed
                {
                    // Codes here ETC ..
                case 3: // The third item listed
                    {
                    // Codes here ETC ..
                }
                case 4:
                    {
                    // Codes here ETC ..
                    }
            }
            }
    }
    }
    return 1;
}
Try to use this and edit the things in it
Reply
#3

Mate i dont need cases,its just a messagebox!
Reply
#4

And that's what you have to do . You leave it empty and it will appear as a textbox . You have to do that because you are using a messagebox function , otherwise don't use the messagebox function and make it appear as a "ClientMessage" !
Reply
#5

What cmd processor your gamemode use?
Reply
#6

Try this
Hope works!

pawn Код:
if (strcmp("/tlaws", cmdtext, true, 10) == 0)  
    {
        if(IsPlayerConnected(playerid))
        {
            ShowPlayerDialog(playerid,1523,DIALOG_STYLE_MSGBOX,"{FF0000}Traffic Laws{FFFFFF}","\n\
            1. ALWAYS stop to red. You may turn right on red after coming to a full stop if the road is clear.\n\
            2. Civilians have ALWAYS priority,stop and let them pass.\n\
            3. Keep in the Speed limits,in-town limit is 50mp/h and on the high traffic roads is 90-120mph\n\
            4. Always Yeld to emegercy vehicles such LSPD,LSFD,they have priority.\n\
            5. ALWAYS drive on the right side of the road."
,"AGREE","");
          }
        return 1;
    }
Reply
#7

Quote:
Originally Posted by Private200
Посмотреть сообщение
The 0 is the level that a player got to be to use that command
You have absolutely NO IDEA what you are talking about. It has NOTHING to do with the level of the player, or in fact ANYTHING to do with the player.

strcmp = STRing CoMPare. It compares two strings (the command entered and "/tlaws") and sees if they match. The strcmp() function returns 0 if they match.

Don't give false information.
Reply
#8

Quote:
Originally Posted by Private200
Посмотреть сообщение
And that's what you have to do . You leave it empty and it will appear as a textbox . You have to do that because you are using a messagebox function , otherwise don't use the messagebox function and make it appear as a "ClientMessage" !
and then,why do we have the MSGBOX dialogues?are you kidding me?

pds2012,thank you for answering to my post.Actually i cant test it right now,cause i am on my iPad,but can you please explain me what is this "10" on the command?

PHP код:
if (strcmp("/tlaws"cmdtexttrue10) == 0
Reply
#9

Quote:
Originally Posted by geohareas
Посмотреть сообщение
and then,why do we have the MSGBOX dialogues?are you kidding me?

pds2012,thank you for answering to my post.Actually i cant test it right now,cause i am on my iPad,but can you please explain me what is this "10" on the command?

PHP код:
if (strcmp("/tlaws"cmdtexttrue10) == 0
The 10 is the length of the command I believe. Wiki

Also, is your gamemode loading properly? Are other commands working, etc.
Reply
#10

Quote:
Originally Posted by geohareas
Посмотреть сообщение
and then,why do we have the MSGBOX dialogues?are you kidding me?

pds2012,thank you for answering to my post.Actually i cant test it right now,cause i am on my iPad,but can you please explain me what is this "10" on the command?

PHP код:
if (strcmp("/tlaws"cmdtexttrue10) == 0
The 10 is the length, so this line is faulty. /tlaws is only 6 letters long, so 6 would be the correct number to put, however this value isn't even needed.

May we see the rest of your OnPlayerCommandText callback?
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)