Kick and Ban and Announce command
#1

Hello, I'm requiring help on how to make a kick command, ban command and announce command, "all using dialogs" all I need is the code to post under my dialog, but it would be cool if you could show me a zcmd copy aswell, I'v searched and I could not find any working ones. Thanks!
Reply
#2

Imma give you some examples from my script

Kick:
PHP код:
COMMAND:kick(playeridparams[])
{
    new 
id;
    if(
IsPlayerConnected(id))
    {
        if(
PlayerInfo[playerid][AdminLevel] >= 3)
        {
            if(!
sscanf(params"u"id))
            {
                new 
string[64];
                new 
name[MAX_PLAYER_NAME], PlayerName[MAX_PLAYER_NAME];
                
GetPlayerName(playeridnamesizeof(name));
                
GetPlayerName(idPlayerNamesizeof(PlayerName));
                
format(stringsizeof(string), "You Have Been Kicked By %s."name);
                
SendClientMessage(id0xD8D8D8FFstring);
                
format(stringsizeof(string), "You Kicked %s ."id);
                
SendClientMessage(playerid0xD8D8D8FFstring);
                
Kick(id);
                return 
1;
            }
            else return 
SendClientMessage(playerid0xD8D8D8FF"System: /kick [PlayerId/PartOfName]");
        }
        else return 
SendClientMessage(playerid0xD8D8D8FF"Your Not High Enough Level To Use This Command.");
    }
    else return 
SendClientMessage(playerid0xD8D8D8FF"Player is not connected.");

Ban:
PHP код:
COMMAND:ban(playeridparams[])
{
    new 
id;
    if(
IsPlayerConnected(id))
    {
        if(
PlayerInfo[playerid][AdminLevel] >= 4)
        {
            if(!
sscanf(params"u"id))
            {
                new 
string[64];
                new 
name[MAX_PLAYER_NAME], PlayerName[MAX_PLAYER_NAME];
                
GetPlayerName(playeridnamesizeof(name));
                
GetPlayerName(idPlayerNamesizeof(PlayerName));
                
format(stringsizeof(string), "You Have Been Banned By %s."name);
                
SendClientMessage(id0xD8D8D8FFstring);
                
format(stringsizeof(string), "You Banned %s ."id);
                
SendClientMessage(playerid0xD8D8D8FFstring);
                
Ban(id);
                return 
1;
            }
            else return 
SendClientMessage(playerid0xD8D8D8FF"System: /ban [PlayerId/PartOfName]");
        }
        else return 
SendClientMessage(playerid0xD8D8D8FF"Your Not High Enough Level To Use This Command.");
    }
    else return 
SendClientMessage(playerid0xD8D8D8FF"Player is not connected.");

Announce:
PHP код:
COMMAND:announce(playerid,params[])
{
    {
        if(
PlayerInfo[playerid][AdminLevel] >= 4) {
            new
                
poster[40],
                
mess[128];
            
sscanf(params,"s",mess);
            if(!
isnull(mess)) {
                new 
text[128];
                
GetPlayerName(playerid,poster,sizeof(poster));
                
format(text,sizeof(text),"Administrator \"%s\" has announced his message. (%s)",poster,mess);
                
SendClientMessageToAll(0xD8D8D8FF,text);
                
GameTextForAll(mess,5000,3);
                new 
Float:pXFloat:pYFloat:pZ;
                
PlayerPlaySound(playerid,1057,pX,pY,pZ);
            }
            else {
                return 
SendClientMessage(playerid,red,"USAGE: /announce [message], and all players will see this message on-screen.");
            }
        }
        else {
            return 
SendClientMessage(playerid,red,"You are not allowed to use this command.");
        }
        return 
1;
    }

Reply
#3

For the kick one, why do I get Undefined Symbol, Params?
Reply
#4

Didn't you want a dialog tho?
Reply
#5

Yes, And that just made me think, I'll also Need it so when they type in the name, the player will get kicked, so if your able to help, please do.
Reply
#6

Quote:
Originally Posted by dowster
Посмотреть сообщение
Didn't you want a dialog tho?
You can use the base of the code somewhat
Reply
#7

ok, well ill do one to show you and you can do the rest ok?
Reply
#8

Quote:
Originally Posted by dowster
Посмотреть сообщение
ok, well ill do one to show you and you can do the rest ok?
Yes Sir.
Reply
#9

Quote:
Originally Posted by Shockey HD
Посмотреть сообщение
Yes Sir.
haha cut the formalities
Reply
#10

Quote:
Originally Posted by dowster
Посмотреть сообщение
haha cut the formalities
................
Reply
#11

Right, anyways I put those CMDS inside my script in CMD form, I log in, and none of my commands work, login dialog doesnt work, etc etc, anyreason why?

EDIT: A few more questions, How do I make a players score and money save on logout, so when they relog it'll stay t eh same? I know I have to put somthing on OnPlayerDisconnect I just Dont know what
Reply
#12

Quote:
Originally Posted by Azzeto
Посмотреть сообщение
Right, anyways I put those CMDS inside my script in CMD form, I log in, and none of my commands work, login dialog doesnt work, etc etc, anyreason why?

EDIT: A few more questions, How do I make a players score and money save on logout, so when they relog it'll stay t eh same? I know I have to put somthing on OnPlayerDisconnect I just Dont know what
Do you have sscanf?
Reply
#13

I have sscanf2
Reply
#14

pawn Код:
COMMAND:kick(playerid, params[])
{
    ShowPlayerDialog( playerid, 1000, DIALOG_STYLE_INPUT, "Kick Dialog", "Type the name or id of the player to kick", "Kick", "Cancel");
}  
public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[])
{
    switch (dialogid)
    {
        case 1000:
        {
            if(!response) return SendClientMessage(playerid, 0xFF0000FF, "You cancled the ban dialog");
            else
            {
                new id;
                if(IsPlayerConnected(id))
                {
                    if(PlayerInfo[playerid][AdminLevel] >= 3)
                    {
                        if(!sscanf(inputtext, "u", id))
                        {
                            new string[64];
                            new name[MAX_PLAYER_NAME], PlayerName[MAX_PLAYER_NAME];
                            GetPlayerName(playerid, name, sizeof(name));
                            GetPlayerName(id, PlayerName, sizeof(PlayerName));
                            format(string, sizeof(string), "You Have Been Kicked By %s.", name);
                            SendClientMessage(id, 0xD8D8D8FF, string);
                            format(string, sizeof(string), "You Kicked %s .", id);
                            SendClientMessage(playerid, 0xD8D8D8FF, string);
                            Kick(id);
                            return 1;
                        }
                        else return SendClientMessage(playerid, 0xD8D8D8FF, "System: /kick [PlayerId/PartOfName]");
                    }
                    else return SendClientMessage(playerid, 0xD8D8D8FF, "Your Not High Enough Level To Use This Command.");
                }
                else return SendClientMessage(playerid, 0xD8D8D8FF, "Player is not connected.");
            }              
        }
    }
    return 1;
}
Thats the kick command ShockeyHD gave you, probably from his cousins script ;P lol, but yeah, thats how you intergrate it
Reply
#15

Quote:
Originally Posted by dowster
Посмотреть сообщение
pawn Код:
COMMAND:kick(playerid, params[])
{
    ShowPlayerDialog( playerid, 1000, DIALOG_STYLE_INPUT, "Kick Dialog", "Type the name or id of the player to kick", "Kick", "Cancel");
}  
public OnDialogResponse( playerid, dialogid, response, listitem, inputtext[])
{
    switch (dialogid)
    {
        case 1000:
        {
            if(!response) return SendClientMessage(playerid, 0xFF0000FF, "You cancled the ban dialog");
            else
            {
                new id;
                if(IsPlayerConnected(id))
                {
                    if(PlayerInfo[playerid][AdminLevel] >= 3)
                    {
                        if(!sscanf(inputtext, "u", id))
                        {
                            new string[64];
                            new name[MAX_PLAYER_NAME], PlayerName[MAX_PLAYER_NAME];
                            GetPlayerName(playerid, name, sizeof(name));
                            GetPlayerName(id, PlayerName, sizeof(PlayerName));
                            format(string, sizeof(string), "You Have Been Kicked By %s.", name);
                            SendClientMessage(id, 0xD8D8D8FF, string);
                            format(string, sizeof(string), "You Kicked %s .", id);
                            SendClientMessage(playerid, 0xD8D8D8FF, string);
                            Kick(id);
                            return 1;
                        }
                        else return SendClientMessage(playerid, 0xD8D8D8FF, "System: /kick [PlayerId/PartOfName]");
                    }
                    else return SendClientMessage(playerid, 0xD8D8D8FF, "Your Not High Enough Level To Use This Command.");
                }
                else return SendClientMessage(playerid, 0xD8D8D8FF, "Player is not connected.");
            }              
        }
    }
    return 1;
}
Thats the kick command ShockeyHD gave you, probably from his cousins script ;P lol, but yeah, thats how you intergrate it
Shut up... xD
Reply
#16

...And once again, it bugs everything, login dialogs, cmds, everything
Reply
#17

Quote:
Originally Posted by Azzeto
Посмотреть сообщение
...And once again, it bugs everything, login dialogs, cmds, everything
Try to use sscanf instead of sscanf2 idk if that will work
Reply
#18

Ill try that.. and do you know how to make it so when an administrator goes on duty it says "Administrator *admins name* has went on admin duty? It feels like somthing very simple but I cannot figure it out
Reply
#19

Quote:
Originally Posted by Azzeto
Посмотреть сообщение
Ill try that.. and do you know how to make it so when an administrator goes on duty it says "Administrator *admins name* has went on admin duty? It feels like somthing very simple but I cannot figure it out
well, you can start off with the simple /admins

PHP код:
COMMAND:admins(playeridparams[])
{
    new 
sendername[20];
    new 
string[256];
    if(
IsPlayerConnected(playerid)) {
        
SendClientMessage(playerid,Green,"Admins Online:");
        for(new 
0MAX_PLAYERSi++) {
            if(
IsPlayerConnected(i)) {
                if(
PlayerInfo[playerid][AdminLevel] >= 1) {
                    
GetPlayerName(isendernamesizeof(sendername));
                    
format(string256"Admin: %s"sendername);
                    
SendClientMessage(playerid0x9900FFAAstring);
                }
            }
        }
    }
    return 
1;

Reply
#20

Yea I need it so when an admin goes on duty though I can make it say "administrator*adminsname*has went on duty

Instead of the old "An Administrator has went on duty"

And that still didnt work

EDIT: And that /admins fails anyways.. says everyone is an admin ^^
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)