Ban command help
#1

Hello, I'm trying to make a ban command using a tutorial on the sa-mp forums although, somewhy, I get these following errors.

pawn Код:
C:\Users\vasu\Desktop\Sa-Mp Roleplay Serv\gamemodes\Roleplay.pwn(866) : error 017: undefined symbol "SInfo"
C:\Users\vasu\Desktop\Sa-Mp Roleplay Serv\gamemodes\Roleplay.pwn(866) : warning 215: expression has no effect
C:\Users\vasu\Desktop\Sa-Mp Roleplay Serv\gamemodes\Roleplay.pwn(866) : error 001: expected token: ";", but found "]"
C:\Users\vasu\Desktop\Sa-Mp Roleplay Serv\gamemodes\Roleplay.pwn(866) : error 029: invalid expression, assumed zero
C:\Users\vasu\Desktop\Sa-Mp Roleplay Serv\gamemodes\Roleplay.pwn(866) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
The script for the command is the following.

pawn Код:
CMD:ban(playerid,params[])
{
    if(PlayerInfo[playerid][Level] < 1) return SendClientMessage(playerid, COLOR_GREY, "You can't use this command!");//Checking if the player has admin level 1, if not it sends him a message.
    {
        new id, r[25], string[100];//R = Reason
        new name[MAX_PLAYER_NAME], name2[MAX_PLAYER_NAME];
        if(sscanf(params, "is", id, r)) return SendClientMessage(playerid, 0xF69521AA, "USAGE: /ban [id] [reason]");
        {
            if(id != INVALID_PLAYER_ID)
            {
                PlayerInfo[id][Banned]=1;//To Make Player Banned When He Connect It Kick Him
                GetPlayerName(playerid, name, sizeof(name));
                GetPlayerName(id, name2, sizeof(name2));
                format(string, sizeof(string), "%s[%d] has been banned by Admin %s[%d] - %s", id, name2, playerid, name, r);
                else
                if(PlayerInfo[playerid][Level] < 1) format(string, sizeof(string), ""%s[%d] has been banned by Moderator %s[%d] - %s", id, name2, playerid, name, r);
                SendClientMessageToAll(0xFF1493FF, string);
                Kick(ID);
            }
            else SendClientMessage(playerid, COLOR_GREY, "
The specified player is currently not connected.");
        }
    }
    else SendClientMessage(playerid, COLOR_GREY, "
You can't use this command!");
P.S: Ignore the warning please, as I'm aware of it.
Reply
#2

What's line 866?
Reply
#3

There is no "SInfo" in the current code ?

Edit
But you didnt open/close some string tags currectly
Reply
#4

What do you mean park4bmx? There was SInfo in the tutorial but I changed it to PlayerInfo because I think SInfo gave me errors or something, I'm not sure. Isn't SInfo the same as PlayerInfo? Anyhow, I changed those back into SInfo and now I'm getting these errors:

pawn Код:
C:\Users\vasu\Desktop\Sa-Mp Roleplay Serv\gamemodes\Roleplay.pwn(50) : error 017: undefined symbol "SInfo"
C:\Users\vasu\Desktop\Sa-Mp Roleplay Serv\gamemodes\Roleplay.pwn(50) : warning 215: expression has no effect
C:\Users\vasu\Desktop\Sa-Mp Roleplay Serv\gamemodes\Roleplay.pwn(50) : error 001: expected token: ";", but found "]"
C:\Users\vasu\Desktop\Sa-Mp Roleplay Serv\gamemodes\Roleplay.pwn(50) : error 029: invalid expression, assumed zero
C:\Users\vasu\Desktop\Sa-Mp Roleplay Serv\gamemodes\Roleplay.pwn(50) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
@Abagail, this is line 866.

pawn Код:
if(SInfo[playerid][Banned]==1)
Reply
#5

ok, if that is current then show how you set up PlayerInfo/SInfo
and line 50 is exactly ?

And there is wrong string tag like i said
pawn Код:
if(SInfo[playerid][Level] < 1) format(string, sizeof(string), "%s[%d] has been banned by Moderator %s[%d] - %s", id, name2, playerid,
Reply
#6

double posting.
Reply
#7

Quote:
Originally Posted by park4bmx
Посмотреть сообщение
ok, if that is current then show how you set up PlayerInfo/SInfo
and line 50 is exactly ?

And there is wrong string tag like i said
pawn Код:
if(SInfo[playerid][Level] < 1) format(string, sizeof(string), "%s[%d] has been banned by Moderator %s[%d] - %s", id, name2, playerid,
I don't know what you mean by telling me to show you how I set up playerinfo and SInfo, I'm sorry. The following code is line 50, like you asked.

pawn Код:
INI_Int("Banned",SInfo[playerid][Banned]);
BTW: I changed
pawn Код:
if(SInfo[playerid][Level] < 1) format(string, sizeof(string), "%s[%d] has been banned by Moderator %s[%d] - %s", id, name2, playerid,
that code you sent me with my last one, but still 4 errors.

pawn Код:
C:\Users\vasu\Desktop\Sa-Mp Roleplay Serv\gamemodes\Roleplay.pwn(50) : error 017: undefined symbol "SInfo"
C:\Users\vasu\Desktop\Sa-Mp Roleplay Serv\gamemodes\Roleplay.pwn(50) : warning 215: expression has no effect
C:\Users\vasu\Desktop\Sa-Mp Roleplay Serv\gamemodes\Roleplay.pwn(50) : error 001: expected token: ";", but found "]"
C:\Users\vasu\Desktop\Sa-Mp Roleplay Serv\gamemodes\Roleplay.pwn(50) : error 029: invalid expression, assumed zero
C:\Users\vasu\Desktop\Sa-Mp Roleplay Serv\gamemodes\Roleplay.pwn(50) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
Reply
#8

You are pasting us the wrong piece of code.

pawn Код:
CMD:ban(playerid,params[])
{
    if(PlayerInfo[playerid][Level] < 1) return SendClientMessage(playerid, COLOR_GREY, "You can't use this command!");//Checking if the player has admin level 1, if not it sends him a message.
    new id, r[32], string[96], name[MAX_PLAYER_NAME], name2[MAX_PLAYER_NAME];
    if(sscanf(params, "is[32](No Reason Specified)", id, r)) return SendClientMessage(playerid, 0xF69521AA, "USAGE: /ban [id] [reason]");
    if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GREY, "The specified player is currently not connected.");
    PlayerInfo[id][Banned] = 1;//To Make Player Banned When He Connect It Kick Him
    GetPlayerName(playerid, name, sizeof(name));
    GetPlayerName(id, name2, sizeof(name2));
    if(PlayerInfo[playerid][Level] <= 1) format(string, sizeof(string), "%s[%d] has been banned by Moderator %s[%d] - %s", id, name2, playerid, name, r);
    else format(string, sizeof(string), "%s[%d] has been banned by Admin %s[%d] - %s", id, name2, playerid, name, r);
    SendClientMessageToAll(0xFF1493FF, string);
    Kick(id);
}
Anyway, try this ^
Reply
#9

Alguem pode Responder meu Post? https://sampforum.blast.hk/showthread.php?tid=498082
Reply
#10

Thanks Kar, but now I get the following warning.

pawn Код:
C:\Users\vasu\Desktop\Sa-Mp Roleplay Serv\gamemodes\Roleplay.pwn(1166) : warning 209: function "cmd_ban" should return a value
I'd really appriciate some help.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)