Anyone can give me /rules?
#1

my server have no /rules command.. and i don't know how to make once.. can you give me some that i can copy? i don't like textdraw's because i don't know how to use it, dialogs will be thank you!
Reply
#2

https://sampwiki.blast.hk/wiki/OnDialogResponse

pawn Код:
// Define the dialog ID so we can handle responses
#define DIALOG_RULES 1
 
// In some command
ShowPlayerDialog(playerid, DIALOG_RULES, DIALOG_STYLE_MSGBOX, "Server Rules", "- No Cheating\n- No Spamming\n- Respect Admins\n\nDo you agree to these rules?", "Yes", "No");
 
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_RULES)
    {
        if(response) // If they clicked 'Yes' or pressed enter
        {
            SendClientMessage(playerid, COLOR_GREEN, "Thank you for agreeing to the server rules!");
        }
        else // Pressed ESC or clicked cancel
        {
            KickWithMessage(playerid, COLOR_RED, "You MUST agree to the server rules to play here.");
            //For info & code of this function please refer to the bottom of this article.
        }
        return 1; // We handled a dialog, so return 1. Just like OnPlayerCommandText.
    }
 
    return 0; // You MUST return 0 here! Just like OnPlayerCommandText.
}

forward KickPublic(playerid);
public KickPublic(playerid) { Kick(playerid); }
 
stock KickWithMessage(playerid, color, message[])
{
    SendClientMessage(playerid, color, message);
    SetTimerEx("KickPublic", 1000, 0, "d", playerid);   //Delay of 1 second before kicking the player so he recieves the message
}
Reply
#3

bro im noob in that can u give me the read code?
Reply
#4

Do you mean this?

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/help", true))
    {
        ShowPlayerDialog(playerid, DIALOG_RULES, DIALOG_STYLE_MSGBOX, "Server Rules", "- No Cheating\n- No Spamming\n- Respect Admins\n\nDo you agree to these rules?", "Yes", "No");

        return 1;
    }

    return 0;
}
Reply
#5

error!!

Код:
C:\Users\Louis Alcosaba\Desktop\LSCNR\gamemodes\1.2.pwn(1722) : error 029: invalid expression, assumed zero
C:\Users\Louis Alcosaba\Desktop\LSCNR\gamemodes\1.2.pwn(1722) : error 004: function "zcmd_OnPlayerCommandText" is not implemented
C:\Users\Louis Alcosaba\Desktop\LSCNR\gamemodes\1.2.pwn(1723) : warning 217: loose indentation
C:\Users\Louis Alcosaba\Desktop\LSCNR\gamemodes\1.2.pwn(1724) : error 017: undefined symbol "cmdtext"
C:\Users\Louis Alcosaba\Desktop\LSCNR\gamemodes\1.2.pwn(1735) : warning 225: unreachable code
C:\Users\Louis Alcosaba\Desktop\LSCNR\gamemodes\1.2.pwn(1735) : warning 217: loose indentation
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
this is the code that errors.. line 1722-1735

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/help", true))
    {
        ShowPlayerDialog(playerid, DIALOG_RULES, DIALOG_STYLE_MSGBOX, "Server Rules", "- No Cheating\n- No Spamming\n- Respect Admins\n\nDo you agree to these rules?", "Yes", "No");

        return 1;
    }

    return 0;
}
Reply
#6

What line is that on?
Reply
#7

that code u gave to me..
Reply
#8

https://sampforum.blast.hk/showthread.php?tid=447813
Reply
#9

okay ill try to post in there..
Reply
#10

CMD:rules(playerid)
{
SendClientMessage(playerid, COLOR_RED, "1. This is a rule");
return 1;
}

Assuming your script is in ZCMD, if it's not, I recommend you convert it to that. It's the best command processor in my honest opinion. Also sorry if there's any typos in the script I posted, I'm typing all this from a phone. But, that should give you a basic understanding on how to write a /rules cmd
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)