SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 21/03/2014, 11:51 AM   #1
Sojo12
Banned
 
Join Date: Jul 2013
Location: Search and you'll find it...
Posts: 444
Reputation: 43
Default unban cmd error

I took this code from this forum only but im getting else erros and dont know how to fix it.Help will be appreciated.
Code:
Code:
CMD:unban(playerid, params[])
{
        new string[128];
        new pName[24];
        if(isnull(params)) return SendClientMessage(playerid, -1, "{FF0099}[ADMIN]{FFFFFF} /unban [playername]");
        {
            format(string, 128, "{FF0099}[ADMIN]{FFFFFF} '%s' has been unbanned by %s.", params,pName);
            SendClientMessageToAll(COLOR_ADMIN,string);
            new year, month,day;
            getdate(year, month, day);
            new playa[MAX_PLAYER_NAME];
            GetPlayerName(playerid, playa, MAX_PLAYER_NAME);
            format(string, sizeof(string), "{FF0099}[ADMIN]{FFFFFF} '%s' has been unbanned by %s.", params, playa);
            SendClientMessageToAll(COLOR_ADMIN, string);
        }
        else
        {
            SendClientMessage( playerid, -1, "{FF0000}[ERROR]{FFFFFF}Not a banned account or no such account was found!" );
        }
    return 1;
}
Sojo12 is offline   Reply With Quote
Old 21/03/2014, 11:57 AM   #2
MythicalMarauder
Big Clucker
 
MythicalMarauder's Avatar
 
Join Date: Feb 2014
Location: United Arab Emirates
Posts: 116
Reputation: 7
Default Re: unban cmd error

Show us your errors?
__________________
"Anger gives motivation without purpose"
MythicalMarauder is offline   Reply With Quote
Old 21/03/2014, 12:06 PM   #3
Sojo12
Banned
 
Join Date: Jul 2013
Location: Search and you'll find it...
Posts: 444
Reputation: 43
Default Re: unban cmd error

Code:
C:\Users\HACKIFYOUCAN\Desktop\NEW\FunGaming Stunt-Freeroam\gamemodes\SFCRRPG.pwn(5502) : error 029: invalid expression, assumed zero
In line 5502 its like this
Code:
}
        else
}
Sojo12 is offline   Reply With Quote
Old 21/03/2014, 12:13 PM   #4
UnknownOwner
Banned
 
Join Date: Jan 2014
Posts: 370
Reputation: 38
Default Re: unban cmd error

Must be:
Code:
}
else
{
UnknownOwner is offline   Reply With Quote
Old 21/03/2014, 12:19 PM   #5
Hanuman
Banned
 
Join Date: Jan 2014
Location: !In your Dreams!
Posts: 241
Reputation: 35
Default Re: unban cmd error

you need to define a condition
Code:
new string[128];
        new pName[24];
        if(isnull(params)) return SendClientMessage(playerid, -1, "{FF0099}[ADMIN]{FFFFFF} /unban [playername]");
        if(//File present)//like this
        {
            format(string, 128, "{FF0099}[ADMIN]{FFFFFF} '%s' has been unbanned by %s.", params,pName);
            SendClientMessageToAll(COLOR_ADMIN,string);
Hanuman is offline   Reply With Quote
Old 21/03/2014, 12:39 PM   #6
Sojo12
Banned
 
Join Date: Jul 2013
Location: Search and you'll find it...
Posts: 444
Reputation: 43
Default Re: unban cmd error

@Unknown its like that only but i was unable to make it like that overhere.
Hanuman im testng it right now!NOt working.
Another one please
Sojo12 is offline   Reply With Quote
Old 21/03/2014, 03:02 PM   #7
Carac
Little Clucker
 
Join Date: Mar 2011
Posts: 46
Reputation: 1
Default Re: unban cmd error

I'm using this one
pawn Code:
CMD:unban(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pBanAppealer] >= 1)
    {
        if(AdminDuty[playerid] != 1 && PlayerInfo[playerid][pAdmin] < 5)
        {
            SendClientMessage(playerid,COLOR_WHITE, "You're not on-duty as admin. To access your admin commands you must be on-duty. Type /aduty to go on-duty.");
            return 1;
        }

        new string[128];
        if(isnull(params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /unban [playername]");

        if(doesAccountExist(params))
        {
            OnPlayerOfflineLogin(params);
            if(PlayerInfo[MAX_PLAYERS][pPermaBanned] == 1)
            {
                SendClientMessage(playerid, COLOR_WHITE, "Permanently banned accounts can only be unbanned via FTP.");
            }
            else
            {
                if(PlayerInfo[MAX_PLAYERS][pBanned] >= 1)
                {
                    PlayerInfo[MAX_PLAYERS][pBanned] = 0;

                    if(PlayerInfo[MAX_PLAYERS][pWarns] == 3)
                        PlayerInfo[MAX_PLAYERS][pWarns] = 0;

                    RemoveBan(PlayerInfo[MAX_PLAYERS][pIP]);
                    OnPlayerOfflineSave(params);
                    format(string, 128, "AdmCmd: %s (IP:%s) was unbanned by %s.", params, PlayerInfo[MAX_PLAYERS][pIP], GetPlayerNameEx(playerid));
                    ABroadCast(COLOR_LIGHTRED,string,2);
                    format(string, sizeof(string), "AdmCmd: %s (IP:%s) was unbanned by %s.", params, PlayerInfo[MAX_PLAYERS][pIP], GetPlayerNameEx(playerid));
                    Log("logs/ban.log", string);
                }
                else
                {
                    SendClientMessage(playerid, COLOR_WHITE, "Not a banned account!");
                }
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_WHITE, "That account doesn't exist.");
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_GRAD1, "You're not authorized to use that command!");
    }
    return 1;
}
__________________
Carac is offline   Reply With Quote
Old 21/03/2014, 03:13 PM   #8
Konstantinos
Spam Machine
 
Konstantinos's Avatar
 
Join Date: Dec 2011
Posts: 11,863
Reputation: 1399
Default Re: unban cmd error

The command is incomplete. You check an if statement and then you return an error message. After than you open a bracket and do the code to unban (even though, it's just message. It doesn't actually unban the player) and then you check an else statement when you didn't use an if before. Like Hanuman said, you need to use an if statement that checks if the player is banned (everything depends on how you ban a player).

If you don't know how to make a simple ban/unban command by yourself, check some tutorials or filterscripts out. It will help you a lot!
__________________
Life is like riding a bicycle. To keep your balance, you must keep moving.

[Tutorial] How to use SQLite
[FilterScript] Tune System
Konstantinos is offline   Reply With Quote
Old 21/03/2014, 03:15 PM   #9
Hanuman
Banned
 
Join Date: Jan 2014
Location: !In your Dreams!
Posts: 241
Reputation: 35
Default Re: unban cmd error

u are using dini or YSI?
Hanuman is offline   Reply With Quote
Old 21/03/2014, 03:31 PM   #10
Sojo12
Banned
 
Join Date: Jul 2013
Location: Search and you'll find it...
Posts: 444
Reputation: 43
Default Re: unban cmd error

dini
Sojo12 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
unban help pls MORJAN1122 Scripting Help 1 12/12/2013 03:40 PM
Unban? GhostyXL General 4 03/02/2013 04:16 PM
Help unban c0smin Scripting Help 0 01/04/2012 10:14 PM
How to unban? Vic1990 Scripting Help 4 27/11/2011 08:41 AM


All times are GMT. The time now is 05:33 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.