SA-MP Forums Archive
script crashing my Pawno - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: script crashing my Pawno (/showthread.php?tid=289194)



script crashing my Pawno - Zonoya - 10.10.2011

this script is crashing my pawno i dont know why and as its doing this i cant give any errors just the script
pawn Код:
#define FILTERSCRIPT

#include <a_samp>
#include <YSI\y_ini>
#include <sscanf2>
#include <dudb>
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
#define SendMSG(%0,%1,%2,%3) do{new _str[128]; format(_str,128,%2,%3); SendClientMessage(%0,%1,_str);}while(FALSE) // Credits to ******
#include <a_zones>

#define PATH "/Admin System/Users/%s.ini"

#define PLAYER_MUST_REGISTER
#define REGISTERED_MONEY 5000

#define white 0xFFFFFFA
#define RED          0xE60000AA
#define ABLUE        0x2641FEAA
/* ** Colours ** */
#define COL_WHITE "{FFFFFF}"
#define COL_RED "{F81414}"
#define COL_GREEN "{00FF22}"
#define COL_LIGHTBLUE "{00CED1}"
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_GRAD2 0xBFC0C2FF
#define COLOR_WHITE  0xFFFFFFAA
#define color               0xDFF00
#define Red 0xFF0000FF
#define Grey 0xAFAFAFAA
#define Green 0x33AA33AA
#define Yellow 0xFFFF00AA
#define White 0xFFFFFFAA
#define Blue 0x0000BBAA
#define Lightblue 0x33CCFFAA
#define Orange 0xFF9900AA
#define Lime 0x10F441AA
#define Magenta 0xFF00FFF
#define Navy 0x000080AA
#define Aqua 0xF0F8FFAA
#define Crimson 0xDC143CAA
#define Black 0x000000AA
#define Brown 0XA52A2AAA
#define Gold 0xB8860BAA
#define Limegreen 0x32CD32AA
#define Purpley 0x8080FF
#define red 0xFF0000AA
#define lime 0x00FF00FF
#define yellow 0xFFFF00FF

#define CALLSIGN_DIALOG 1000
#define DIALOG_REGISTER 999
#define DIALOG_LOGIN 998

#define FormatMSG(%0,%1,%2,%3)\
        do{\
            format( _S_T_R_, sizeof ( _S_T_R_ ), ( %2 ), %3);\
            SendClientMessage( ( %0 ),( %1 ), _S_T_R_);\
        }\
        while ( False )


#pragma unused ret_memcpy

enum iDetails {
    Pass,
    Cash,
    Score,
    AdminLevel,
    VIPLevel,
    Registered,
    Banned,
    AutoLogin,
    Callsign
};
new pInfo[MAX_PLAYERS][iDetails];



new _S_T_R_[ 1000 ];
new False=false;

if(pInfo[playerid][AutoLogin] == 1)
    new pIP[MAX_PLAYERS][16];
}

new pLogged[MAX_PLAYERS];
new pBanned[MAX_PLAYERS];
new pAFK[MAX_PLAYER_NAME];
new pOnDuty[MAX_PLAYER_NAME];
new pReport[MAX_PLAYER_NAME];


stock PlayerPath(playerid) {
    new iStr[256],name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    format(iStr,sizeof(iStr),PATH,name);
    return iStr;
}

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print("Login & Register & Admin System by Bella");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

public OnGameModeExit()
{
    return 1;
}

forward UserDataLoad_data(playerid,name[],value[]);

public UserDataLoad_data(playerid,name[],value[]) {
    INI_Int("Pass",pInfo[playerid][Pass]);
    if(pInfo[playerid][AutoLogin] == 1)
        INI_String("IP",pIP[playerid],16);
    }
    INI_Int("Cash",pInfo[playerid][Cash]);
    INI_Int("Score",pInfo[playerid][Score]);
    INI_Int("AdminLevel", pInfo[playerid][AdminLevel]);
    INI_Int("VIPLevel", pInfo[playerid][VIPLevel]);
    INI_Int("Registered", pInfo[playerid][Registered]);
    INI_Int("Banned", pInfo[playerid][Banned]);
    INI_Int("Auto_Login", pInfo[playerid][AutoLogin]);
    INI_Int("Callsign", pInfo[playerid][Callsign]);
    return 1;
}

public OnPlayerConnect(playerid)
{
    pLogged[playerid] = 0;
    pAFK[playerid] = 0;
    pOnDuty[playerid] = 0;
    if(pInfo[playerid][AutoLogin] == 1)
        new tmpIP[16];
        GetPlayerIp(playerid,tmpIP,sizeof(tmpIP));
    }
    if(fexist(PlayerPath(playerid))) {
        INI_ParseFile(PlayerPath(playerid), "UserDataLoad_%s", .bExtra = true, .extra = playerid);
        if(pInfo[playerid][AutoLogin] == 1)
            if(strcmp(tmpIP,pIP[playerid],true) == 0) {
                pLogged[playerid] = 1;
                SetPlayerScore(playerid,pInfo[playerid][Score]);
                GivePlayerMoney(playerid,pInfo[playerid][Cash]);
                SendClientMessage(playerid,lime,"You've been auto-logged in. [set like this]");
                return 1;
            }
        }
        ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login","Please enter your password below.","Login","Leave");
    } else {
        ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Register","Please register by entering a password below.","Register","Leave");
    }
    if(pBanned[playerid] == 1)
    {
        SendClientMessage(playerid, RED, "You Are Currently Banned from PH Bye Bye");
        Kick(playerid);
    }
    if(pInfo[playerid][AdminLevel])
    {
        pOnDuty[playerid] = 1;
        SendClientMessage(playerid,lime,"Welcome to PH Administrator / Moderator");
    }
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    if(pLogged[playerid] == 1) {
        new INI:iFile = INI_Open(PlayerPath(playerid));
        INI_SetTag(iFile,"data");
        INI_WriteInt(iFile,"Cash",GetPlayerMoney(playerid));
        INI_WriteInt(iFile,"Score",GetPlayerScore(playerid));
        INI_WriteInt(iFile,"AdminLevel",pInfo[playerid][AdminLevel]);
        INI_WriteInt(iFile,"VIPLevel", pInfo[playerid][VIPLevel]);
        INI_WriteInt(iFile,"Auto_Login", pInfo[playerid][AutoLogin]);
        INI_Close(iFile);
    }
    pLogged[playerid] = 0;
    pAFK[playerid] = 0;
    pOnDuty[playerid] = 0;
    return 1;
}

public OnPlayerRequestSpawn(playerid)
{
    if(pLogged[playerid] == 0) return SendClientMessage(playerid,yellow,"You must register or login before spawning!");
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_REGISTER) {
        GetPlayerIp(playerid,pIP[playerid],16);
        if(!response) Kick(playerid);
        if(!strlen(inputtext)) return ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Register","Please enter a password.","Register","Leave");
        new INI:iFile = INI_Open(PlayerPath(playerid));
        INI_SetTag(iFile,"data");
        INI_WriteInt(iFile,"Pass",udb_hash(inputtext));
        if(pInfo[playerid][AutoLogin] == 1)
            INI_WriteString(iFile,"IP",pIP[playerid]);
        }
        INI_WriteInt(iFile,"Cash",REGISTERED_MONEY);
        INI_WriteInt(iFile,"Score",0);
        INI_WriteInt(iFile,"AdminLevel",0);
        INI_WriteInt(iFile,"VIPLevel",0);
        INI_WriteInt(iFile,"Registered",1);
        INI_WriteInt(iFile,"Banned",0);
        INI_WriteInt(iFile,"Auto_Login",0);
        INI_Close(iFile);
        pLogged[playerid] = 1;
        new iStr[128];
        format(iStr,sizeof(iStr),"You've successfully registered with the password \"%s\".",inputtext);
        SendClientMessage(playerid,yellow,iStr);
        return 1;
    }
    if(dialogid == DIALOG_LOGIN) {
        if(!response) Kick(playerid);
        new iStr[128],gTries;
        if(gTries == 0) gTries = 1;
        if(gTries == 3) {
            new pName[30];
            GetPlayerName(playerid,pName,sizeof(pName));
            format(iStr,sizeof(iStr),"%s has been kicked for exceeding login tries.",pName);
            SendClientMessageToAll(red,iStr);
            return Kick(playerid);
        }
        if(!strlen(inputtext)) {
            format(iStr,sizeof(iStr),"Please enter your password. Tries: %i/3",gTries);
            return ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login",iStr,"Login","Leave");
        }
        if(udb_hash(inputtext) == pInfo[playerid][Pass]) {
            pLogged[playerid] = 1;
            SendClientMessage(playerid,lime,"You've successfully logged in.");
            SetPlayerScore(playerid,pInfo[playerid][Score]);
            GivePlayerMoney(playerid,pInfo[playerid][Cash]);
        } else {
            format(iStr,sizeof(iStr),"Incorrect password. Tries: %i/3",gTries);
            ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Register",iStr,"Login","Leave");
            gTries++;
            return 1;
        }
        return 1;
    }
    if(dialogid == CALLSIGN_DIALOG)
    {
        if(strlen(inputtext))
        {
            new INI:iFile = INI_Open(PlayerPath(playerid));
            INI_SetTag(iFile,"data");
            INI_WriteInt(iFile,"Callsign",inputtext);
            INI_Close(iFile);
        }
        return 1;
    }
    return 0;
}
//================================================================== [StandardCMDS] ==========================================================//
dcmd_PM(playerid, params[])
{
    new id, message, pmstring1[128], pmstring2[128];
    if(sscanf(params, "ui", id, message)) return SendClientMessage(playerid, RED,"USAGE:{FFFF00}/PM [playerid] [Message]");
    if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, RED,"ERROR Player Specified is Offline");
    if(id == playerid) return SendClientMessage(playerid, RED,"You can't PM yourself"); // Optional
    {
        format(pmstring1, sizeof(pmstring1),"[PM Message Recived From %s] %s", PlayerName2(playerid), message);
        SendClientMessage(id, Yellow, pmstring1);
        format(pmstring2, sizeof(pmstring2),"[PM Message Sent To %s] %s", PlayerName2(id), message);
        SendClientMessage(playerid, Yellow, pmstring2);
    }
    return 1;
}
dcmd_Loc(playerid, params[])
{
    new id;
    if(sscanf(params, "u", id)) return SendClientMessage(playerid, RED, "USAGE:{FFFF00}/loc [id]");
    if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, RED,"ERROR Player Specified is Offline");
    if(id == playerid) return SendClientMessage(playerid, RED,"You can't Locate Yourself");
    {
        new r[128], zone[128];
        GetPlayer2DZone(id, zone, sizeof(zone));
        format(r, sizeof(r),"Player %s Is in %s", PlayerName2(id), zone);
        SendClientMessage(playerid, Yellow, r);
    }
    return 1;
}
dcmd_AFK(playerid, params[])
{
    new string[128], afkreason[50];
    if(sscanf(params, "s[128]", afkreason)) return SendClientMessage(playerid, RED,"USAGE:{FFFF00}/afk [Reason]");
    if(!strlen(afkreason))
    if(pAFK[playerid] == 0)
    {
        format(string, sizeof(string),"%s is not AFK [No Reason Given]", PlayerName2(playerid));
        SendClientMessageToAll(Yellow, string);
        pAFK[playerid] = 1;
    }
    else
    {
        format(string, sizeof(string),"%s is now AFK [Reason: %s]", PlayerName2(playerid), afkreason);
        SendClientMessageToAll(Yellow, string);
        pAFK[playerid] = 1;
    }
    else if(pAFK[playerid] == 1)
    {
        format(string, sizeof(string),"%s is now back from %s", PlayerName2(playerid), afkreason);
        SendClientMessageToAll(Yellow, string);
        pAFK[playerid] = 0;
    }
    return 1;
}
dcmd_AFKList(playerid, params[])
{
    new count = 0;
    new string[128];
    #pragma unused params

    SendClientMessage(playerid, Green, " ");
    SendClientMessage(playerid, Green, "___________ |- Current AFK Players -| ___________");
    SendClientMessage(playerid, Green, " ");

    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(pAFK[i] == 1)
            {
                count++;
                GetPlayerName(i, pAFK, sizeof(pAFK));
                format(string, sizeof(string), "%s\n", pAFK);
                SendClientMessage(playerid, Yellow, string);
                SendClientMessage(playerid, Green, " ");
                SendClientMessage(playerid, Green, "_____________________________________________");
            }
        }
    }
    if(count == 0)
    {
        SendClientMessage(playerid, Yellow,"No one is AFK here buddy.");
        SendClientMessage(playerid, Green, " ");
        SendClientMessage(playerid, Green, "_____________________________________________");
        SendClientMessage(playerid, Green, " ");
    }
    return 1;
}
dcmd_Admins(playerid, params[])
{
    new count = 0;
    new string[128];
    #pragma unused params
   
    SendClientMessage(playerid, Green, " ");
    SendClientMessage(playerid, Green, "___________ |- Current Online Admins -| ___________");
    SendClientMessage(playerid, Green, " ");
   
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(pInfo[i][AdminLevel] == 1)
            {
                count++;
                new name[24];
                GetPlayerName(i, name, sizeof(name));
                format(string, sizeof(string), "%s [LVL %d][Rank: Junior Modorator]\n", name, pInfo[i][AdminLevel]);
                SendClientMessage(playerid, Yellow, string);
                SendClientMessage(playerid, Green, " ");
                SendClientMessage(playerid, Green, "________________________________________________");
            }
            if(pInfo[i][AdminLevel] == 2)
            {
                count++;
                new name[24];
                GetPlayerName(i, name, sizeof(name));
                format(string, sizeof(string), "%s [LVL %d][Rank: Modorator]\n", name, pInfo[i][AdminLevel]);
                SendClientMessage(playerid, Yellow, string);
                SendClientMessage(playerid, Green, " ");
                SendClientMessage(playerid, Green, "________________________________________________");
            }
            if(pInfo[i][AdminLevel] == 3)
            {
                count++;
                new name[24];
                GetPlayerName(i, name, sizeof(name));
                format(string, sizeof(string), "%s [LVL %d][Rank: Super Moderator]\n", name, pInfo[i][AdminLevel]);
                SendClientMessage(playerid, Yellow, string);
                SendClientMessage(playerid, Green, " ");
                SendClientMessage(playerid, Green, "________________________________________________");
            }
            if(pInfo[i][AdminLevel] == 4)
            {
                count++;
                new name[24];
                GetPlayerName(i, name, sizeof(name));
                format(string, sizeof(string), "%s [LVL %d][Rank: Junior Admin]\n", name, pInfo[i][AdminLevel]);
                SendClientMessage(playerid, Yellow, string);
                SendClientMessage(playerid, Green, " ");
                SendClientMessage(playerid, Green, "________________________________________________");
            }
            if(pInfo[i][AdminLevel] == 5)
            {
                count++;
                new name[24];
                GetPlayerName(i, name, sizeof(name));
                format(string, sizeof(string), "%s [LVL %d][Rank: Super Admin]\n", name, pInfo[i][AdminLevel]);
                SendClientMessage(playerid, Yellow, string);
                SendClientMessage(playerid, Green, " ");
                SendClientMessage(playerid, Green, "________________________________________________");
            }
            if(pInfo[i][AdminLevel] == 6)
            {
                count++;
                new name[24];
                GetPlayerName(i, name, sizeof(name));
                format(string, sizeof(string), "%s [LVL %d][Rank: Head Admin]\n", name, pInfo[i][AdminLevel]);
                SendClientMessage(playerid, Yellow, string);
                SendClientMessage(playerid, Green, " ");
                SendClientMessage(playerid, Green, "________________________________________________");
            }
            if(pInfo[i][AdminLevel] == 1335)
            {
                count++;
                new name[24];
                GetPlayerName(i, name, sizeof(name));
                format(string, sizeof(string), "%s [LVL %d][Rank: Co-Co-Owner]\n", name, pInfo[i][AdminLevel]);
                SendClientMessage(playerid, Yellow, string);
                SendClientMessage(playerid, Green, " ");
                SendClientMessage(playerid, Green, "________________________________________________");
            }
            if(pInfo[i][AdminLevel] == 1336)
            {
                count++;
                new name[24];
                GetPlayerName(i, name, sizeof(name));
                format(string, sizeof(string), "%s [LVL %d][Rank: Co-Owner]\n", name, pInfo[i][AdminLevel]);
                SendClientMessage(playerid, Yellow, string);
                SendClientMessage(playerid, Green, " ");
                SendClientMessage(playerid, Green, "________________________________________________");
            }
            if(pInfo[i][AdminLevel] == 1337)
            {
                count++;
                new name[24];
                GetPlayerName(i, name, sizeof(name));
                format(string, sizeof(string), "%s [LVL %d][Rank: Owner]\n", name, pInfo[i][AdminLevel]);
                SendClientMessage(playerid, Yellow, string);
                SendClientMessage(playerid, Green, " ");
                SendClientMessage(playerid, Green, "________________________________________________");
            }
        }
    }
    if(count == 0)
    {
        SendClientMessage(playerid, Yellow,"No Admins online right now buddy.");
        SendClientMessage(playerid, Green, " ");
        SendClientMessage(playerid, Green, "_______________________________________________");
        SendClientMessage(playerid, Green, " ");
    }
    return 1;
}
dcmd_Report(playerid, params[])
{
    new Player, Reason;
    if(sscanf(params, "ui", Player, Reason)) return SendClientMessage(playerid, RED,"USAGE: {FFFF00}/Report [PlayerID] [Reason]");
    if(Player == playerid) return SendClientMessage(playerid, RED,"You can't crash yourself"); // Optional
   
    if(IsPlayerConnected(Player))
    {
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
                if(pOnDuty[i] == 1)
                {
                    FormatMSG(i, ABLUE, "You Have Been sent a report on %s by %s Reason %s", PlayerName2(Player), PlayerName2(playerid), Reason);
                    FormatMSG(playerid, ABLUE, "You Have sent a report on %s to %s Reason %s", PlayerName2(Player), PlayerName2(i), Reason);
                    pReport[Player] = 1;
                }
            }
            else return SendClientMessage(playerid, RED,"ERROR Admin Specified Not Online!");
        }
    }
    else return SendClientMessage(playerid, RED,"ERROR Player Specified Not Online!");
    return 1;
}
dcmd_callsign(playerid, params[])
{
    #pragma unused params
    new PDialogstring[200];
    format(PDialogstring, sizeof(PDialogstring), "Callsign: %s", pInfo[playerid][Callsign]);
    ShowPlayerDialog(playerid, CALLSIGN_DIALOG, DIALOG_STYLE_LIST, PDialogstring, "OK", "Cancel");
}
//================================================================== [AdminCMDS] ===========================================================//
dcmd_SetLevel(playerid, params[])
{
    if(!(pInfo[playerid][AdminLevel] >= 10)) return SendClientMessage( playerid, RED, "ERROR: You need to be administrator to use this command!" );
    new Player, aLevel;
    if(sscanf(params, "ui", Player, aLevel)) return SendClientMessage(playerid, RED,"USAGE: {FFFF00}/SetLevel [PlayerID] [Admin Level]");
    if(aLevel < 1 || aLevel > 1337 ) return SendClientMessage(playerid, RED, "ERROR: Invalid level! Max admin level you can set is 1337 and the minimum admin u can set it 1!");

    if(IsPlayerConnected(Player))
    {
        new INI:iFile = INI_Open(PlayerPath(playerid));
        FormatMSG(Player, ABLUE, "Welcome To The Pilots Heaven Team %s has set your Level to %d", PlayerName2(playerid), aLevel);
        FormatMSG(playerid, ABLUE, "You Have Set %s's Admin Level to %d", PlayerName2(Player), aLevel);
        INI_SetTag(iFile,"data");
        INI_WriteInt(iFile,"AdminLevel",strval(params[1]));
        INI_Close(iFile);
    }
    else return SendClientMessage(playerid, RED,"ERROR Player Specified Not Online!");
    return 1;
}
dcmd_SetVIPLevel(playerid, params[])
{
    if(!(pInfo[playerid][AdminLevel] >= 10)) return SendClientMessage( playerid, RED, "ERROR: You need to be administrator to use this command!" );
    new Player, vLevel;
    if(sscanf(params, "ui", Player, vLevel)) return SendClientMessage(playerid, RED,"USAGE: {FFFF00}/SetVIPLevel [PlayerID] [VIP Level]");
    if(vLevel > 10 ) return SendClientMessage(playerid, RED, "ERROR: Invalid level! Max VIP level you can set is 10!");

    if(IsPlayerConnected(Player))
    {
        new INI:iFile = INI_Open(PlayerPath(playerid));
        FormatMSG(Player, ABLUE, "%s has set you VIP Level to %d", PlayerName2(playerid), vLevel);
        FormatMSG(playerid, ABLUE, "You have set %s's level to %d", PlayerName2(Player), vLevel);
        INI_SetTag(iFile,"data");
        INI_WriteInt(iFile,"VIPLevel",strval(params[1]));
        INI_Close(iFile);
    }
    else return SendClientMessage(playerid, RED,"ERROR Player Specified Not Online!");
    return 1;
}
dcmd_SetScore(playerid, params[])
{
    new id, score;
    if(!(pInfo[playerid][AdminLevel] >=10)) return SendClientMessage( playerid, RED, "ERROR: You need to be administrator to use this command!" );
    if(sscanf(params, "us[128]", id, score)) return SendClientMessage(playerid, RED, "USAGE: {FFFF00}/SetScore [playerid] [Score]");
    if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, RED,"ERROR Player Specified is Offline");
    {
        FormatMSG(id, Yellow, "You Score has been set to %d by %s", score, PlayerName2(playerid));
        FormatMSG(id, Yellow, "You have set %s's score to %d", PlayerName2(playerid), score);
        SetPlayerScore(id, score);
    }
    return 1;
}
dcmd_Crash(playerid, params[])
{
    new string[128], id, reason[50];
    if(!(pInfo[playerid][AdminLevel] >= 4)) return SendClientMessage( playerid, RED, "ERROR: You need to be administrator to use this command!" );
    if(sscanf(params, "us[128]", id, reason)) return SendClientMessage(playerid, RED,"USAGE: {FFFF00}/Crash [playerid] [reason]");
    if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, RED,"ERROR Player Specified is Offline");
    if(id == playerid) return SendClientMessage(playerid, RED,"You can't crash yourself"); // Optional
    if(!strlen(reason))
    {
        format(string, sizeof(string),"%s Has been crashed by Admin %s [no reason given]",PlayerName2(id),PlayerName2(playerid));
        SendClientMessageToAll(ABLUE, string);
        GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 1000, 0);
        GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 2000, 1);
        GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 3000, 2);
        GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 4000, 3);
        GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 5000, 4);
        GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 6000, 5);
        GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 7000, 6);
    }
    else
    {
        format(string, sizeof(string),"%s has been crashed by Admin %s [Reason: %s]",PlayerName2(id), PlayerName2(playerid), reason);
        SendClientMessageToAll(ABLUE, string);
        GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 1000, 0);
        GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 2000, 1);
        GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 3000, 2);
        GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 4000, 3);
        GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 5000, 4);
        GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 6000, 5);
        GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 7000, 6);
    }
    return 1;
}
dcmd_Ban(playerid, params[])
{
    new string[128], id, reason[50];
    if(!(pInfo[playerid][AdminLevel] >= 4)) return SendClientMessage( playerid, RED, "ERROR: You need to be administrator to use this command!" );
    if(sscanf(params, "us[128]", id, reason)) return SendClientMessage(playerid, RED,"USAGE: {FFFF00}/ban [playerid] [reason]");
    if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, RED,"ERROR Player Specified is Offline");
    if(id == playerid) return SendClientMessage(playerid, RED,"You can't ban yourself"); // Optional
    if(!strlen(reason))
    {
        new INI:iFile = INI_Open(PlayerPath(playerid));
        format(string, sizeof(string),"%s Has been Banned by Admin %s [no reason given]",PlayerName2(id),PlayerName2(playerid));
        SendClientMessageToAll(ABLUE, string);
        INI_SetTag(iFile,"data");
        INI_WriteInt(iFile,"Banned", 1);
        INI_Close(iFile);
        pBanned[id] = 1;
        Kick(id);
    }
    else
    {
        new INI:iFile = INI_Open(PlayerPath(playerid));
        format(string, sizeof(string),"%s has been Banned by Admin %s [Reason: %s]",PlayerName2(id), PlayerName2(playerid), reason);
        SendClientMessageToAll(ABLUE, string);
        INI_SetTag(iFile,"data");
        INI_WriteInt(iFile,"Banned", 1);
        INI_Close(iFile);
        pBanned[id] = 1;
        Kick(id);
    }
    return 1;
}
dcmd_Announce(playerid, params[])
{
    new Message[128];
    if(!(pInfo[playerid][AdminLevel] >= 1)) return SendClientMessage( playerid, RED, "ERROR: You need to be administrator to use this command!" );
    if(sscanf(params, "s[128]", Message)) return SendClientMessage( playerid, RED, "USAGE: {FFFF00}/announce [Message]" );
    {
        GameTextForAll(Message, 6000, 4);
    }
    return 1;
}
dcmd_Kick(playerid, params[])
{
    new string[128], id, reason[50];
    if(!(pInfo[playerid][AdminLevel] >= 4)) return SendClientMessage(playerid, RED, "ERROR: You need to be administrator to use this command!" );
    if(sscanf(params, "us[128]", id, reason)) return SendClientMessage(playerid, RED,"USAGE: {FFFF00}/Kick [playerid] [reason]");
    if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, RED,"ERROR Player Specified is Offline");
    if(id == playerid) return SendClientMessage(playerid, RED,"You can't ban yourself"); // Optional
    if(!strlen(reason))
    {
        format(string, sizeof(string),"%s Has been kicked by Admin %s [no reason given]",PlayerName2(id),PlayerName2(playerid));
        SendClientMessageToAll(ABLUE, string);
        Kick(id);
    }
    else
    {
        format(string, sizeof(string),"%s Has been kicked by Admin %s [Reason: %s]",PlayerName2(id),PlayerName2(playerid), reason);
        SendClientMessageToAll(ABLUE, string);
        Kick(id);
    }
    return 1;
}
dcmd_Vehicle(playerid, params[])
{
    new string[128];
    new Float:X, Float:Y, Float:Z, Float:A;
    new MODEL, COL1, COL2;
    new Admin_Car;
    if(!(pInfo[playerid][AdminLevel] >=2)) return SendClientMessage(playerid, RED, "ERROR: You need to be administrator to use this command!" );
    if(sscanf(params, "ddd", MODEL, COL1, COL2)) return SendClientMessage(playerid, RED,"USAGE: {FFFF00}/Vehicle [modelid] [Color1] [Color2]");
    {
        GetPlayerPos(playerid, X, Y, Z);
        GetPlayerFacingAngle(playerid, A);
        format(string, sizeof(string), "You Have Spawned a car. Model ID: %d Color 1: %d Color 2: %d", MODEL, COL1, COL2);
        SendClientMessage(playerid, ABLUE, string);
        Admin_Car = CreateVehicle(MODEL, X, Y, Z, A, COL1, COL2, 60);
        PutPlayerInVehicle(playerid, Admin_Car, 0);
        SetVehicleNumberPlate(Admin_Car, "Admin_Car");
    }
    return 1;
}
dcmd_Aduty(playerid, params[])
{
    #pragma unused params
    new string[128];
    new string1[128];
    new Text3D:label[MAX_PLAYERS];
    if(!(pInfo[playerid][AdminLevel])) return SendClientMessage(playerid, RED, "ERROR: You Need to be administrator to use this command!");
    if(pOnDuty[playerid] == 0)
    {
        format(string, sizeof(string),"%s is now on Admin Duty DONT ATTACK!!!!!", PlayerName2(playerid));
        SendClientMessageToAll(ABLUE, string);
        format(string1, sizeof(string1),"%s [LVL %d] is on admin duty", PlayerName2(playerid), pInfo[playerid][AdminLevel]);
        label[playerid] = Create3DTextLabel(string1, 0x008080FF, 30.0, 40.0, 50.0, 40.0, 0);
        Attach3DTextLabelToPlayer(label[playerid], playerid, 0.0, 0.0, 0.7);
    }
    else if(pOnDuty[playerid] == 1)
    {
        format(string, sizeof(string),"%s is now off Admin Duty And Enjoys the game", PlayerName2(playerid));
        SendClientMessageToAll(ABLUE, string);
        Delete3DTextLabel(label[playerid]);
    }
    return 1;
}
dcmd_Hide(playerid, params[])
{
    #pragma unused params
    if(!(pInfo[playerid][AdminLevel])) return SendClientMessage(playerid, RED, "ERROR: You Need to be administrator to use this command!");
    {
        SendClientMessage(playerid,ABLUE,"You are hidden from the online admins list");
        pOnDuty[playerid] = 0;
    }
    return 1;
}
dcmd_Show(playerid, params[])
{
    #pragma unused params
    if(!(pInfo[playerid][AdminLevel])) return SendClientMessage(playerid, RED, "ERROR: You Need to be administrator to use this command!");
    {
        SendClientMessage(playerid,ABLUE,"You are no longer hidden from the online admins list");
        pOnDuty[playerid] = 1;
    }
    return 1;
}
//================================================================== [ STOCKS ] ===========================================================//
stock PlayerName2( i )
{
    new n[ 24 ];
    GetPlayerName( i, n, 24 );
    return n;
}

forward GetPlayerAVSAdmin(playerid);
public GetPlayerAVSAdmin(playerid)
{
    return pInfo[playerid][AdminLevel];
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(PM, 2, cmdtext);
    dcmd(Loc, 3, cmdtext);
    dcmd(AFK, 3, cmdtext);
    dcmd(AFKList, 7, cmdtext);
    dcmd(SetLevel, 8, cmdtext);
    dcmd(SetVIPLevel, 11, cmdtext);
    dcmd(Crash, 5, cmdtext);
    dcmd(Ban, 3, cmdtext);
    dcmd(Announce, 8, cmdtext);
    dcmd(Kick, 4, cmdtext);
    dcmd(Aduty, 5, cmdtext);
    dcmd(Admins, 6, cmdtext);
    dcmd(Vehicle, 7, cmdtext);
    dcmd(Hide, 4, cmdtext);
    dcmd(Show, 4, cmdtext);
    dcmd(Report, 6, cmdtext);
    dcmd(SetScore, 8, cmdtext);
    dcmd(callsign, 8, cmdtext);
    return 0;
}
sorry for the bad indentation its the forum but this script is crashing my server can someone tell me why?


Re: script crashing my Pawno - aRoach - 10.10.2011

pawn Код:
if(pInfo[playerid][AutoLogin] == 1)
    new pIP[MAX_PLAYERS][16];
}
WTF?!?!
pawn Код:
new pIP[MAX_PLAYERS][16];
It will be created but not used


Re: script crashing my Pawno - Zonoya - 10.10.2011

if(pInfo[playerid][AutoLogin] == 1)
INI_WriteString(iFile,"IP",pIP[playerid]);
}
its there


Re: script crashing my Pawno - aRoach - 10.10.2011

No, you didn't got it:
Replace this:
pawn Код:
if(pInfo[playerid][AutoLogin] == 1)
    new pIP[MAX_PLAYERS][16];
}
With this:
pawn Код:
new pIP[MAX_PLAYERS][16];
And this:
pawn Код:
if(pInfo[playerid][AutoLogin] == 1)
        INI_String("IP",pIP[playerid],16);
    }
With this:
pawn Код:
if(pInfo[playerid][AutoLogin] == 1) INI_String("IP",pIP[playerid],16);
PS: You missed a lot of {, like this:
pawn Код:
if(pInfo[playerid][AutoLogin] == 1)
        new tmpIP[16];
        GetPlayerIp(playerid,tmpIP,sizeof(tmpIP));
    }
For this your Pawno crashes


Re: script crashing my Pawno - Zonoya - 10.10.2011

Код:
C:\DOCUME~1\Rhys\Desktop\SA8BEC~1\FILTER~1\Account.pwn(82) : error 010: invalid function or declaration
C:\DOCUME~1\Rhys\Desktop\SA8BEC~1\FILTER~1\Account.pwn(85) : error 054: unmatched closing brace ("}")
C:\DOCUME~1\Rhys\Desktop\SA8BEC~1\FILTER~1\Account.pwn(152) : error 017: undefined symbol "tmpIP"
C:\DOCUME~1\Rhys\Desktop\SA8BEC~1\FILTER~1\Account.pwn(262) : error 035: argument type mismatch (argument 3)
C:\DOCUME~1\Rhys\Desktop\SA8BEC~1\FILTER~1\Account.pwn(502) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
now i have these take the new script and look at it urself
pawn Код:
#define FILTERSCRIPT

#include <a_samp>
#include <YSI\y_ini>
#include <sscanf2>
#include <dudb>
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
#define SendMSG(%0,%1,%2,%3) do{new _str[128]; format(_str,128,%2,%3); SendClientMessage(%0,%1,_str);}while(FALSE) // Credits to ******
#include <a_zones>

#define PATH "/Admin System/Users/%s.ini"

#define PLAYER_MUST_REGISTER
#define REGISTERED_MONEY 5000

#define white 0xFFFFFFA
#define RED          0xE60000AA
#define ABLUE        0x2641FEAA
/* ** Colours ** */
#define COL_WHITE "{FFFFFF}"
#define COL_RED "{F81414}"
#define COL_GREEN "{00FF22}"
#define COL_LIGHTBLUE "{00CED1}"
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_GRAD2 0xBFC0C2FF
#define COLOR_WHITE  0xFFFFFFAA
#define color               0xDFF00
#define Red 0xFF0000FF
#define Grey 0xAFAFAFAA
#define Green 0x33AA33AA
#define Yellow 0xFFFF00AA
#define White 0xFFFFFFAA
#define Blue 0x0000BBAA
#define Lightblue 0x33CCFFAA
#define Orange 0xFF9900AA
#define Lime 0x10F441AA
#define Magenta 0xFF00FFF
#define Navy 0x000080AA
#define Aqua 0xF0F8FFAA
#define Crimson 0xDC143CAA
#define Black 0x000000AA
#define Brown 0XA52A2AAA
#define Gold 0xB8860BAA
#define Limegreen 0x32CD32AA
#define Purpley 0x8080FF
#define red 0xFF0000AA
#define lime 0x00FF00FF
#define yellow 0xFFFF00FF

#define CALLSIGN_DIALOG 1000
#define DIALOG_REGISTER 999
#define DIALOG_LOGIN 998

#define FormatMSG(%0,%1,%2,%3)\
        do{\
            format( _S_T_R_, sizeof ( _S_T_R_ ), ( %2 ), %3);\
            SendClientMessage( ( %0 ),( %1 ), _S_T_R_);\
        }\
        while ( False )


#pragma unused ret_memcpy

enum iDetails {
    Pass,
    Cash,
    Score,
    AdminLevel,
    VIPLevel,
    Registered,
    Banned,
    AutoLogin,
    Callsign
};
new pInfo[MAX_PLAYERS][iDetails];



new _S_T_R_[ 1000 ];
new False=false;

if(pInfo[playerid][AutoLogin] == 1)
{
    new pIP[MAX_PLAYERS][16];
}

new pLogged[MAX_PLAYERS];
new pBanned[MAX_PLAYERS];
new pAFK[MAX_PLAYER_NAME];
new pOnDuty[MAX_PLAYER_NAME];
new pReport[MAX_PLAYER_NAME];


stock PlayerPath(playerid) {
    new iStr[256],name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    format(iStr,sizeof(iStr),PATH,name);
    return iStr;
}

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print("Login & Register & Admin System by Bella");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

public OnGameModeExit()
{
    return 1;
}

forward UserDataLoad_data(playerid,name[],value[]);

public UserDataLoad_data(playerid,name[],value[]) {
    INI_Int("Pass",pInfo[playerid][Pass]);
    if(pInfo[playerid][AutoLogin] == 1)
    {
        INI_String("IP",pIP[playerid],16);
    }
    INI_Int("Cash",pInfo[playerid][Cash]);
    INI_Int("Score",pInfo[playerid][Score]);
    INI_Int("AdminLevel", pInfo[playerid][AdminLevel]);
    INI_Int("VIPLevel", pInfo[playerid][VIPLevel]);
    INI_Int("Registered", pInfo[playerid][Registered]);
    INI_Int("Banned", pInfo[playerid][Banned]);
    INI_Int("Auto_Login", pInfo[playerid][AutoLogin]);
    INI_Int("Callsign", pInfo[playerid][Callsign]);
    return 1;
}

public OnPlayerConnect(playerid)
{
    pLogged[playerid] = 0;
    pAFK[playerid] = 0;
    pOnDuty[playerid] = 0;
    if(pInfo[playerid][AutoLogin] == 1)
    {
        new tmpIP[16];
        GetPlayerIp(playerid,tmpIP,sizeof(tmpIP));
    }
    if(fexist(PlayerPath(playerid))) {
        INI_ParseFile(PlayerPath(playerid), "UserDataLoad_%s", .bExtra = true, .extra = playerid);
        if(pInfo[playerid][AutoLogin] == 1)
        {
            if(strcmp(tmpIP,pIP[playerid],true) == 0) {
                pLogged[playerid] = 1;
                SetPlayerScore(playerid,pInfo[playerid][Score]);
                GivePlayerMoney(playerid,pInfo[playerid][Cash]);
                SendClientMessage(playerid,lime,"You've been auto-logged in. [set like this]");
                return 1;
            }
        }
        ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login","Please enter your password below.","Login","Leave");
    } else {
        ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Register","Please register by entering a password below.","Register","Leave");
    }
    if(pBanned[playerid] == 1)
    {
        SendClientMessage(playerid, RED, "You Are Currently Banned from PH Bye Bye");
        Kick(playerid);
    }
    if(pInfo[playerid][AdminLevel])
    {
        pOnDuty[playerid] = 1;
        SendClientMessage(playerid,lime,"Welcome to PH Administrator / Moderator");
    }
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    if(pLogged[playerid] == 1) {
        new INI:iFile = INI_Open(PlayerPath(playerid));
        INI_SetTag(iFile,"data");
        INI_WriteInt(iFile,"Cash",GetPlayerMoney(playerid));
        INI_WriteInt(iFile,"Score",GetPlayerScore(playerid));
        INI_WriteInt(iFile,"AdminLevel",pInfo[playerid][AdminLevel]);
        INI_WriteInt(iFile,"VIPLevel", pInfo[playerid][VIPLevel]);
        INI_WriteInt(iFile,"Auto_Login", pInfo[playerid][AutoLogin]);
        INI_Close(iFile);
    }
    pLogged[playerid] = 0;
    pAFK[playerid] = 0;
    pOnDuty[playerid] = 0;
    return 1;
}

public OnPlayerRequestSpawn(playerid)
{
    if(pLogged[playerid] == 0) return SendClientMessage(playerid,yellow,"You must register or login before spawning!");
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_REGISTER) {
        GetPlayerIp(playerid,pIP[playerid],16);
        if(!response) Kick(playerid);
        if(!strlen(inputtext)) return ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Register","Please enter a password.","Register","Leave");
        new INI:iFile = INI_Open(PlayerPath(playerid));
        INI_SetTag(iFile,"data");
        INI_WriteInt(iFile,"Pass",udb_hash(inputtext));
        if(pInfo[playerid][AutoLogin] == 1)
        {
            INI_WriteString(iFile,"IP",pIP[playerid]);
        }
        INI_WriteInt(iFile,"Cash",REGISTERED_MONEY);
        INI_WriteInt(iFile,"Score",0);
        INI_WriteInt(iFile,"AdminLevel",0);
        INI_WriteInt(iFile,"VIPLevel",0);
        INI_WriteInt(iFile,"Registered",1);
        INI_WriteInt(iFile,"Banned",0);
        INI_WriteInt(iFile,"Auto_Login",0);
        INI_Close(iFile);
        pLogged[playerid] = 1;
        new iStr[128];
        format(iStr,sizeof(iStr),"You've successfully registered with the password \"%s\".",inputtext);
        SendClientMessage(playerid,yellow,iStr);
        return 1;
    }
    if(dialogid == DIALOG_LOGIN) {
        if(!response) Kick(playerid);
        new iStr[128],gTries;
        if(gTries == 0) gTries = 1;
        if(gTries == 3) {
            new pName[30];
            GetPlayerName(playerid,pName,sizeof(pName));
            format(iStr,sizeof(iStr),"%s has been kicked for exceeding login tries.",pName);
            SendClientMessageToAll(red,iStr);
            return Kick(playerid);
        }
        if(!strlen(inputtext)) {
            format(iStr,sizeof(iStr),"Please enter your password. Tries: %i/3",gTries);
            return ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login",iStr,"Login","Leave");
        }
        if(udb_hash(inputtext) == pInfo[playerid][Pass]) {
            pLogged[playerid] = 1;
            SendClientMessage(playerid,lime,"You've successfully logged in.");
            SetPlayerScore(playerid,pInfo[playerid][Score]);
            GivePlayerMoney(playerid,pInfo[playerid][Cash]);
        } else {
            format(iStr,sizeof(iStr),"Incorrect password. Tries: %i/3",gTries);
            ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Register",iStr,"Login","Leave");
            gTries++;
            return 1;
        }
        return 1;
    }
    if(dialogid == CALLSIGN_DIALOG)
    {
        if(strlen(inputtext))
        {
            new INI:iFile = INI_Open(PlayerPath(playerid));
            INI_SetTag(iFile,"data");
            INI_WriteInt(iFile,"Callsign",inputtext);
            INI_Close(iFile);
        }
        return 1;
    }
    return 0;
}
//================================================================== [StandardCMDS] ==========================================================//
dcmd_PM(playerid, params[])
{
    new id, message, pmstring1[128], pmstring2[128];
    if(sscanf(params, "ui", id, message)) return SendClientMessage(playerid, RED,"USAGE:{FFFF00}/PM [playerid] [Message]");
    if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, RED,"ERROR Player Specified is Offline");
    if(id == playerid) return SendClientMessage(playerid, RED,"You can't PM yourself"); // Optional
    {
        format(pmstring1, sizeof(pmstring1),"[PM Message Recived From %s] %s", PlayerName2(playerid), message);
        SendClientMessage(id, Yellow, pmstring1);
        format(pmstring2, sizeof(pmstring2),"[PM Message Sent To %s] %s", PlayerName2(id), message);
        SendClientMessage(playerid, Yellow, pmstring2);
    }
    return 1;
}
dcmd_Loc(playerid, params[])
{
    new id;
    if(sscanf(params, "u", id)) return SendClientMessage(playerid, RED, "USAGE:{FFFF00}/loc [id]");
    if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, RED,"ERROR Player Specified is Offline");
    if(id == playerid) return SendClientMessage(playerid, RED,"You can't Locate Yourself");
    {
        new r[128], zone[128];
        GetPlayer2DZone(id, zone, sizeof(zone));
        format(r, sizeof(r),"Player %s Is in %s", PlayerName2(id), zone);
        SendClientMessage(playerid, Yellow, r);
    }
    return 1;
}
dcmd_AFK(playerid, params[])
{
    new string[128], afkreason[50];
    if(sscanf(params, "s[128]", afkreason)) return SendClientMessage(playerid, RED,"USAGE:{FFFF00}/afk [Reason]");
    if(!strlen(afkreason))
    if(pAFK[playerid] == 0)
    {
        format(string, sizeof(string),"%s is not AFK [No Reason Given]", PlayerName2(playerid));
        SendClientMessageToAll(Yellow, string);
        pAFK[playerid] = 1;
    }
    else
    {
        format(string, sizeof(string),"%s is now AFK [Reason: %s]", PlayerName2(playerid), afkreason);
        SendClientMessageToAll(Yellow, string);
        pAFK[playerid] = 1;
    }
    else if(pAFK[playerid] == 1)
    {
        format(string, sizeof(string),"%s is now back from %s", PlayerName2(playerid), afkreason);
        SendClientMessageToAll(Yellow, string);
        pAFK[playerid] = 0;
    }
    return 1;
}
dcmd_AFKList(playerid, params[])
{
    new count = 0;
    new string[128];
    #pragma unused params

    SendClientMessage(playerid, Green, " ");
    SendClientMessage(playerid, Green, "___________ |- Current AFK Players -| ___________");
    SendClientMessage(playerid, Green, " ");

    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(pAFK[i] == 1)
            {
                count++;
                GetPlayerName(i, pAFK, sizeof(pAFK));
                format(string, sizeof(string), "%s\n", pAFK);
                SendClientMessage(playerid, Yellow, string);
                SendClientMessage(playerid, Green, " ");
                SendClientMessage(playerid, Green, "_____________________________________________");
            }
        }
    }
    if(count == 0)
    {
        SendClientMessage(playerid, Yellow,"No one is AFK here buddy.");
        SendClientMessage(playerid, Green, " ");
        SendClientMessage(playerid, Green, "_____________________________________________");
        SendClientMessage(playerid, Green, " ");
    }
    return 1;
}
dcmd_Admins(playerid, params[])
{
    new count = 0;
    new string[128];
    #pragma unused params
   
    SendClientMessage(playerid, Green, " ");
    SendClientMessage(playerid, Green, "___________ |- Current Online Admins -| ___________");
    SendClientMessage(playerid, Green, " ");
   
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(pInfo[i][AdminLevel] == 1)
            {
                count++;
                new name[24];
                GetPlayerName(i, name, sizeof(name));
                format(string, sizeof(string), "%s [LVL %d][Rank: Junior Modorator]\n", name, pInfo[i][AdminLevel]);
                SendClientMessage(playerid, Yellow, string);
                SendClientMessage(playerid, Green, " ");
                SendClientMessage(playerid, Green, "________________________________________________");
            }
            if(pInfo[i][AdminLevel] == 2)
            {
                count++;
                new name[24];
                GetPlayerName(i, name, sizeof(name));
                format(string, sizeof(string), "%s [LVL %d][Rank: Modorator]\n", name, pInfo[i][AdminLevel]);
                SendClientMessage(playerid, Yellow, string);
                SendClientMessage(playerid, Green, " ");
                SendClientMessage(playerid, Green, "________________________________________________");
            }
            if(pInfo[i][AdminLevel] == 3)
            {
                count++;
                new name[24];
                GetPlayerName(i, name, sizeof(name));
                format(string, sizeof(string), "%s [LVL %d][Rank: Super Moderator]\n", name, pInfo[i][AdminLevel]);
                SendClientMessage(playerid, Yellow, string);
                SendClientMessage(playerid, Green, " ");
                SendClientMessage(playerid, Green, "________________________________________________");
            }
            if(pInfo[i][AdminLevel] == 4)
            {
                count++;
                new name[24];
                GetPlayerName(i, name, sizeof(name));
                format(string, sizeof(string), "%s [LVL %d][Rank: Junior Admin]\n", name, pInfo[i][AdminLevel]);
                SendClientMessage(playerid, Yellow, string);
                SendClientMessage(playerid, Green, " ");
                SendClientMessage(playerid, Green, "________________________________________________");
            }
            if(pInfo[i][AdminLevel] == 5)
            {
                count++;
                new name[24];
                GetPlayerName(i, name, sizeof(name));
                format(string, sizeof(string), "%s [LVL %d][Rank: Super Admin]\n", name, pInfo[i][AdminLevel]);
                SendClientMessage(playerid, Yellow, string);
                SendClientMessage(playerid, Green, " ");
                SendClientMessage(playerid, Green, "________________________________________________");
            }
            if(pInfo[i][AdminLevel] == 6)
            {
                count++;
                new name[24];
                GetPlayerName(i, name, sizeof(name));
                format(string, sizeof(string), "%s [LVL %d][Rank: Head Admin]\n", name, pInfo[i][AdminLevel]);
                SendClientMessage(playerid, Yellow, string);
                SendClientMessage(playerid, Green, " ");
                SendClientMessage(playerid, Green, "________________________________________________");
            }
            if(pInfo[i][AdminLevel] == 1335)
            {
                count++;
                new name[24];
                GetPlayerName(i, name, sizeof(name));
                format(string, sizeof(string), "%s [LVL %d][Rank: Co-Co-Owner]\n", name, pInfo[i][AdminLevel]);
                SendClientMessage(playerid, Yellow, string);
                SendClientMessage(playerid, Green, " ");
                SendClientMessage(playerid, Green, "________________________________________________");
            }
            if(pInfo[i][AdminLevel] == 1336)
            {
                count++;
                new name[24];
                GetPlayerName(i, name, sizeof(name));
                format(string, sizeof(string), "%s [LVL %d][Rank: Co-Owner]\n", name, pInfo[i][AdminLevel]);
                SendClientMessage(playerid, Yellow, string);
                SendClientMessage(playerid, Green, " ");
                SendClientMessage(playerid, Green, "________________________________________________");
            }
            if(pInfo[i][AdminLevel] == 1337)
            {
                count++;
                new name[24];
                GetPlayerName(i, name, sizeof(name));
                format(string, sizeof(string), "%s [LVL %d][Rank: Owner]\n", name, pInfo[i][AdminLevel]);
                SendClientMessage(playerid, Yellow, string);
                SendClientMessage(playerid, Green, " ");
                SendClientMessage(playerid, Green, "________________________________________________");
            }
        }
    }
    if(count == 0)
    {
        SendClientMessage(playerid, Yellow,"No Admins online right now buddy.");
        SendClientMessage(playerid, Green, " ");
        SendClientMessage(playerid, Green, "_______________________________________________");
        SendClientMessage(playerid, Green, " ");
    }
    return 1;
}
dcmd_Report(playerid, params[])
{
    new Player, Reason;
    if(sscanf(params, "ui", Player, Reason)) return SendClientMessage(playerid, RED,"USAGE: {FFFF00}/Report [PlayerID] [Reason]");
    if(Player == playerid) return SendClientMessage(playerid, RED,"You can't crash yourself"); // Optional
   
    if(IsPlayerConnected(Player))
    {
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
                if(pOnDuty[i] == 1)
                {
                    FormatMSG(i, ABLUE, "You Have Been sent a report on %s by %s Reason %s", PlayerName2(Player), PlayerName2(playerid), Reason);
                    FormatMSG(playerid, ABLUE, "You Have sent a report on %s to %s Reason %s", PlayerName2(Player), PlayerName2(i), Reason);
                    pReport[Player] = 1;
                }
            }
            else return SendClientMessage(playerid, RED,"ERROR Admin Specified Not Online!");
        }
    }
    else return SendClientMessage(playerid, RED,"ERROR Player Specified Not Online!");
    return 1;
}
dcmd_callsign(playerid, params[])
{
    #pragma unused params
    new PDialogstring[200];
    format(PDialogstring, sizeof(PDialogstring), "Callsign: %s", pInfo[playerid][Callsign]);
    ShowPlayerDialog(playerid, CALLSIGN_DIALOG, DIALOG_STYLE_LIST, PDialogstring, "OK", "Cancel");
}
//================================================================== [AdminCMDS] ===========================================================//
dcmd_SetLevel(playerid, params[])
{
    if(!(pInfo[playerid][AdminLevel] >= 10)) return SendClientMessage( playerid, RED, "ERROR: You need to be administrator to use this command!" );
    new Player, aLevel;
    if(sscanf(params, "ui", Player, aLevel)) return SendClientMessage(playerid, RED,"USAGE: {FFFF00}/SetLevel [PlayerID] [Admin Level]");
    if(aLevel < 1 || aLevel > 1337 ) return SendClientMessage(playerid, RED, "ERROR: Invalid level! Max admin level you can set is 1337 and the minimum admin u can set it 1!");

    if(IsPlayerConnected(Player))
    {
        new INI:iFile = INI_Open(PlayerPath(playerid));
        FormatMSG(Player, ABLUE, "Welcome To The Pilots Heaven Team %s has set your Level to %d", PlayerName2(playerid), aLevel);
        FormatMSG(playerid, ABLUE, "You Have Set %s's Admin Level to %d", PlayerName2(Player), aLevel);
        INI_SetTag(iFile,"data");
        INI_WriteInt(iFile,"AdminLevel",strval(params[1]));
        INI_Close(iFile);
    }
    else return SendClientMessage(playerid, RED,"ERROR Player Specified Not Online!");
    return 1;
}
dcmd_SetVIPLevel(playerid, params[])
{
    if(!(pInfo[playerid][AdminLevel] >= 10)) return SendClientMessage( playerid, RED, "ERROR: You need to be administrator to use this command!" );
    new Player, vLevel;
    if(sscanf(params, "ui", Player, vLevel)) return SendClientMessage(playerid, RED,"USAGE: {FFFF00}/SetVIPLevel [PlayerID] [VIP Level]");
    if(vLevel > 10 ) return SendClientMessage(playerid, RED, "ERROR: Invalid level! Max VIP level you can set is 10!");

    if(IsPlayerConnected(Player))
    {
        new INI:iFile = INI_Open(PlayerPath(playerid));
        FormatMSG(Player, ABLUE, "%s has set you VIP Level to %d", PlayerName2(playerid), vLevel);
        FormatMSG(playerid, ABLUE, "You have set %s's level to %d", PlayerName2(Player), vLevel);
        INI_SetTag(iFile,"data");
        INI_WriteInt(iFile,"VIPLevel",strval(params[1]));
        INI_Close(iFile);
    }
    else return SendClientMessage(playerid, RED,"ERROR Player Specified Not Online!");
    return 1;
}
dcmd_SetScore(playerid, params[])
{
    new id, score;
    if(!(pInfo[playerid][AdminLevel] >=10)) return SendClientMessage( playerid, RED, "ERROR: You need to be administrator to use this command!" );
    if(sscanf(params, "us[128]", id, score)) return SendClientMessage(playerid, RED, "USAGE: {FFFF00}/SetScore [playerid] [Score]");
    if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, RED,"ERROR Player Specified is Offline");
    {
        FormatMSG(id, Yellow, "You Score has been set to %d by %s", score, PlayerName2(playerid));
        FormatMSG(id, Yellow, "You have set %s's score to %d", PlayerName2(playerid), score);
        SetPlayerScore(id, score);
    }
    return 1;
}
dcmd_Crash(playerid, params[])
{
    new string[128], id, reason[50];
    if(!(pInfo[playerid][AdminLevel] >= 4)) return SendClientMessage( playerid, RED, "ERROR: You need to be administrator to use this command!" );
    if(sscanf(params, "us[128]", id, reason)) return SendClientMessage(playerid, RED,"USAGE: {FFFF00}/Crash [playerid] [reason]");
    if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, RED,"ERROR Player Specified is Offline");
    if(id == playerid) return SendClientMessage(playerid, RED,"You can't crash yourself"); // Optional
    if(!strlen(reason))
    {
        format(string, sizeof(string),"%s Has been crashed by Admin %s [no reason given]",PlayerName2(id),PlayerName2(playerid));
        SendClientMessageToAll(ABLUE, string);
        GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 1000, 0);
        GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 2000, 1);
        GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 3000, 2);
        GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 4000, 3);
        GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 5000, 4);
        GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 6000, 5);
        GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 7000, 6);
    }
    else
    {
        format(string, sizeof(string),"%s has been crashed by Admin %s [Reason: %s]",PlayerName2(id), PlayerName2(playerid), reason);
        SendClientMessageToAll(ABLUE, string);
        GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 1000, 0);
        GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 2000, 1);
        GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 3000, 2);
        GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 4000, 3);
        GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 5000, 4);
        GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 6000, 5);
        GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 7000, 6);
    }
    return 1;
}
dcmd_Ban(playerid, params[])
{
    new string[128], id, reason[50];
    if(!(pInfo[playerid][AdminLevel] >= 4)) return SendClientMessage( playerid, RED, "ERROR: You need to be administrator to use this command!" );
    if(sscanf(params, "us[128]", id, reason)) return SendClientMessage(playerid, RED,"USAGE: {FFFF00}/ban [playerid] [reason]");
    if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, RED,"ERROR Player Specified is Offline");
    if(id == playerid) return SendClientMessage(playerid, RED,"You can't ban yourself"); // Optional
    if(!strlen(reason))
    {
        new INI:iFile = INI_Open(PlayerPath(playerid));
        format(string, sizeof(string),"%s Has been Banned by Admin %s [no reason given]",PlayerName2(id),PlayerName2(playerid));
        SendClientMessageToAll(ABLUE, string);
        INI_SetTag(iFile,"data");
        INI_WriteInt(iFile,"Banned", 1);
        INI_Close(iFile);
        pBanned[id] = 1;
        Kick(id);
    }
    else
    {
        new INI:iFile = INI_Open(PlayerPath(playerid));
        format(string, sizeof(string),"%s has been Banned by Admin %s [Reason: %s]",PlayerName2(id), PlayerName2(playerid), reason);
        SendClientMessageToAll(ABLUE, string);
        INI_SetTag(iFile,"data");
        INI_WriteInt(iFile,"Banned", 1);
        INI_Close(iFile);
        pBanned[id] = 1;
        Kick(id);
    }
    return 1;
}
dcmd_Announce(playerid, params[])
{
    new Message[128];
    if(!(pInfo[playerid][AdminLevel] >= 1)) return SendClientMessage( playerid, RED, "ERROR: You need to be administrator to use this command!" );
    if(sscanf(params, "s[128]", Message)) return SendClientMessage( playerid, RED, "USAGE: {FFFF00}/announce [Message]" );
    {
        GameTextForAll(Message, 6000, 4);
    }
    return 1;
}
dcmd_Kick(playerid, params[])
{
    new string[128], id, reason[50];
    if(!(pInfo[playerid][AdminLevel] >= 4)) return SendClientMessage(playerid, RED, "ERROR: You need to be administrator to use this command!" );
    if(sscanf(params, "us[128]", id, reason)) return SendClientMessage(playerid, RED,"USAGE: {FFFF00}/Kick [playerid] [reason]");
    if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, RED,"ERROR Player Specified is Offline");
    if(id == playerid) return SendClientMessage(playerid, RED,"You can't ban yourself"); // Optional
    if(!strlen(reason))
    {
        format(string, sizeof(string),"%s Has been kicked by Admin %s [no reason given]",PlayerName2(id),PlayerName2(playerid));
        SendClientMessageToAll(ABLUE, string);
        Kick(id);
    }
    else
    {
        format(string, sizeof(string),"%s Has been kicked by Admin %s [Reason: %s]",PlayerName2(id),PlayerName2(playerid), reason);
        SendClientMessageToAll(ABLUE, string);
        Kick(id);
    }
    return 1;
}
dcmd_Vehicle(playerid, params[])
{
    new string[128];
    new Float:X, Float:Y, Float:Z, Float:A;
    new MODEL, COL1, COL2;
    new Admin_Car;
    if(!(pInfo[playerid][AdminLevel] >=2)) return SendClientMessage(playerid, RED, "ERROR: You need to be administrator to use this command!" );
    if(sscanf(params, "ddd", MODEL, COL1, COL2)) return SendClientMessage(playerid, RED,"USAGE: {FFFF00}/Vehicle [modelid] [Color1] [Color2]");
    {
        GetPlayerPos(playerid, X, Y, Z);
        GetPlayerFacingAngle(playerid, A);
        format(string, sizeof(string), "You Have Spawned a car. Model ID: %d Color 1: %d Color 2: %d", MODEL, COL1, COL2);
        SendClientMessage(playerid, ABLUE, string);
        Admin_Car = CreateVehicle(MODEL, X, Y, Z, A, COL1, COL2, 60);
        PutPlayerInVehicle(playerid, Admin_Car, 0);
        SetVehicleNumberPlate(Admin_Car, "Admin_Car");
    }
    return 1;
}
dcmd_Aduty(playerid, params[])
{
    #pragma unused params
    new string[128];
    new string1[128];
    new Text3D:label[MAX_PLAYERS];
    if(!(pInfo[playerid][AdminLevel])) return SendClientMessage(playerid, RED, "ERROR: You Need to be administrator to use this command!");
    if(pOnDuty[playerid] == 0)
    {
        format(string, sizeof(string),"%s is now on Admin Duty DONT ATTACK!!!!!", PlayerName2(playerid));
        SendClientMessageToAll(ABLUE, string);
        format(string1, sizeof(string1),"%s [LVL %d] is on admin duty", PlayerName2(playerid), pInfo[playerid][AdminLevel]);
        label[playerid] = Create3DTextLabel(string1, 0x008080FF, 30.0, 40.0, 50.0, 40.0, 0);
        Attach3DTextLabelToPlayer(label[playerid], playerid, 0.0, 0.0, 0.7);
    }
    else if(pOnDuty[playerid] == 1)
    {
        format(string, sizeof(string),"%s is now off Admin Duty And Enjoys the game", PlayerName2(playerid));
        SendClientMessageToAll(ABLUE, string);
        Delete3DTextLabel(label[playerid]);
    }
    return 1;
}
dcmd_Hide(playerid, params[])
{
    #pragma unused params
    if(!(pInfo[playerid][AdminLevel])) return SendClientMessage(playerid, RED, "ERROR: You Need to be administrator to use this command!");
    {
        SendClientMessage(playerid,ABLUE,"You are hidden from the online admins list");
        pOnDuty[playerid] = 0;
    }
    return 1;
}
dcmd_Show(playerid, params[])
{
    #pragma unused params
    if(!(pInfo[playerid][AdminLevel])) return SendClientMessage(playerid, RED, "ERROR: You Need to be administrator to use this command!");
    {
        SendClientMessage(playerid,ABLUE,"You are no longer hidden from the online admins list");
        pOnDuty[playerid] = 1;
    }
    return 1;
}
//================================================================== [ STOCKS ] ===========================================================//
stock PlayerName2( i )
{
    new n[ 24 ];
    GetPlayerName( i, n, 24 );
    return n;
}

forward GetPlayerAVSAdmin(playerid);
public GetPlayerAVSAdmin(playerid)
{
    return pInfo[playerid][AdminLevel];
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(PM, 2, cmdtext);
    dcmd(Loc, 3, cmdtext);
    dcmd(AFK, 3, cmdtext);
    dcmd(AFKList, 7, cmdtext);
    dcmd(SetLevel, 8, cmdtext);
    dcmd(SetVIPLevel, 11, cmdtext);
    dcmd(Crash, 5, cmdtext);
    dcmd(Ban, 3, cmdtext);
    dcmd(Announce, 8, cmdtext);
    dcmd(Kick, 4, cmdtext);
    dcmd(Aduty, 5, cmdtext);
    dcmd(Admins, 6, cmdtext);
    dcmd(Vehicle, 7, cmdtext);
    dcmd(Hide, 4, cmdtext);
    dcmd(Show, 4, cmdtext);
    dcmd(Report, 6, cmdtext);
    dcmd(SetScore, 8, cmdtext);
    dcmd(callsign, 8, cmdtext);
    return 0;
}



Re: script crashing my Pawno - .:Kaos:. - 10.10.2011

Код:
if(pInfo[playerid][AutoLogin] == 1)
{
    new pIP[MAX_PLAYERS][16];
}
Can't be out by itself. Put it under a callback.


Re: script crashing my Pawno - Zonoya - 10.10.2011

thx fixed


Re: script crashing my Pawno - aRoach - 10.10.2011

pawn Код:
#define FILTERSCRIPT

#include <a_samp>
#include <YSI\y_ini>
#include <sscanf2>
#include <dudb>
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
#define SendMSG(%0,%1,%2,%3) do{new _str[128]; format(_str,128,%2,%3); SendClientMessage(%0,%1,_str);}while(FALSE) // Credits to ******
#include <a_zones>

#define PATH "/Admin System/Users/%s.ini"

#define PLAYER_MUST_REGISTER
#define REGISTERED_MONEY 5000

#define white 0xFFFFFFA
#define RED          0xE60000AA
#define ABLUE        0x2641FEAA
/* ** Colours ** */
#define COL_WHITE "{FFFFFF}"
#define COL_RED "{F81414}"
#define COL_GREEN "{00FF22}"
#define COL_LIGHTBLUE "{00CED1}"
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_GRAD2 0xBFC0C2FF
#define COLOR_WHITE  0xFFFFFFAA
#define color               0xDFF00
#define Red 0xFF0000FF
#define Grey 0xAFAFAFAA
#define Green 0x33AA33AA
#define Yellow 0xFFFF00AA
#define White 0xFFFFFFAA
#define Blue 0x0000BBAA
#define Lightblue 0x33CCFFAA
#define Orange 0xFF9900AA
#define Lime 0x10F441AA
#define Magenta 0xFF00FFF
#define Navy 0x000080AA
#define Aqua 0xF0F8FFAA
#define Crimson 0xDC143CAA
#define Black 0x000000AA
#define Brown 0XA52A2AAA
#define Gold 0xB8860BAA
#define Limegreen 0x32CD32AA
#define Purpley 0x8080FF
#define red 0xFF0000AA
#define lime 0x00FF00FF
#define yellow 0xFFFF00FF

#define CALLSIGN_DIALOG 1000
#define DIALOG_REGISTER 999
#define DIALOG_LOGIN 998

#define FormatMSG(%0,%1,%2,%3)\
        do{\
            format( _S_T_R_, sizeof ( _S_T_R_ ), ( %2 ), %3);\
            SendClientMessage( ( %0 ),( %1 ), _S_T_R_);\
        }\
        while ( False )


#pragma unused ret_memcpy

enum iDetails {
    Pass,
    Cash,
    Score,
    AdminLevel,
    VIPLevel,
    Registered,
    Banned,
    AutoLogin,
    Callsign
};
new pInfo[MAX_PLAYERS][iDetails];



new _S_T_R_[ 1000 ];
new False=false;

new pIP[MAX_PLAYERS][16];


new pLogged[MAX_PLAYERS];
new pBanned[MAX_PLAYERS];
new pAFK[MAX_PLAYER_NAME];
new pOnDuty[MAX_PLAYER_NAME];
new pReport[MAX_PLAYER_NAME];


stock PlayerPath(playerid) {
    new iStr[256],name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    format(iStr,sizeof(iStr),PATH,name);
    return iStr;
}

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print("Login & Register & Admin System by Bella");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

public OnGameModeExit()
{
    return 1;
}

forward UserDataLoad_data(playerid,name[],value[]);

public UserDataLoad_data(playerid,name[],value[]) {
    INI_Int("Pass",pInfo[playerid][Pass]);
    if(pInfo[playerid][AutoLogin] == 1)
        INI_String("IP",pIP[playerid],16);
    INI_Int("Cash",pInfo[playerid][Cash]);
    INI_Int("Score",pInfo[playerid][Score]);
    INI_Int("AdminLevel", pInfo[playerid][AdminLevel]);
    INI_Int("VIPLevel", pInfo[playerid][VIPLevel]);
    INI_Int("Registered", pInfo[playerid][Registered]);
    INI_Int("Banned", pInfo[playerid][Banned]);
    INI_Int("Auto_Login", pInfo[playerid][AutoLogin]);
    INI_Int("Callsign", pInfo[playerid][Callsign]);
    return 1;
}

public OnPlayerConnect(playerid)
{
    new tmpIP[16];
    pLogged[playerid] = 0;
    pAFK[playerid] = 0;
    pOnDuty[playerid] = 0;
    if(pInfo[playerid][AutoLogin] == 1){
        GetPlayerIp(playerid,tmpIP,sizeof(tmpIP));
    }
    if(fexist(PlayerPath(playerid))) {
        INI_ParseFile(PlayerPath(playerid), "UserDataLoad_%s", .bExtra = true, .extra = playerid);
        if(pInfo[playerid][AutoLogin] == 1){
            if(strcmp(tmpIP,pIP[playerid],true) == 0) {
                pLogged[playerid] = 1;
                SetPlayerScore(playerid,pInfo[playerid][Score]);
                GivePlayerMoney(playerid,pInfo[playerid][Cash]);
                SendClientMessage(playerid,lime,"You've been auto-logged in. [set like this]");
                return 1;
            }
        }
        ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login","Please enter your password below.","Login","Leave");
    } else {
        ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Register","Please register by entering a password below.","Register","Leave");
    }
    if(pBanned[playerid] == 1)
    {
        SendClientMessage(playerid, RED, "You Are Currently Banned from PH Bye Bye");
        Kick(playerid);
    }
    if(pInfo[playerid][AdminLevel])
    {
        pOnDuty[playerid] = 1;
        SendClientMessage(playerid,lime,"Welcome to PH Administrator / Moderator");
    }
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    if(pLogged[playerid] == 1) {
        new INI:iFile = INI_Open(PlayerPath(playerid));
        INI_SetTag(iFile,"data");
        INI_WriteInt(iFile,"Cash",GetPlayerMoney(playerid));
        INI_WriteInt(iFile,"Score",GetPlayerScore(playerid));
        INI_WriteInt(iFile,"AdminLevel",pInfo[playerid][AdminLevel]);
        INI_WriteInt(iFile,"VIPLevel", pInfo[playerid][VIPLevel]);
        INI_WriteInt(iFile,"Auto_Login", pInfo[playerid][AutoLogin]);
        INI_Close(iFile);
    }
    pLogged[playerid] = 0;
    pAFK[playerid] = 0;
    pOnDuty[playerid] = 0;
    return 1;
}

public OnPlayerRequestSpawn(playerid)
{
    if(pLogged[playerid] == 0) return SendClientMessage(playerid,yellow,"You must register or login before spawning!");
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_REGISTER) {
        GetPlayerIp(playerid,pIP[playerid],16);
        if(!response) Kick(playerid);
        if(!strlen(inputtext)) return ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Register","Please enter a password.","Register","Leave");
        new INI:iFile = INI_Open(PlayerPath(playerid));
        INI_SetTag(iFile,"data");
        INI_WriteInt(iFile,"Pass",udb_hash(inputtext));
        if(pInfo[playerid][AutoLogin] == 1) INI_WriteString(iFile,"IP",pIP[playerid]);

        INI_WriteInt(iFile,"Cash",REGISTERED_MONEY);
        INI_WriteInt(iFile,"Score",0);
        INI_WriteInt(iFile,"AdminLevel",0);
        INI_WriteInt(iFile,"VIPLevel",0);
        INI_WriteInt(iFile,"Registered",1);
        INI_WriteInt(iFile,"Banned",0);
        INI_WriteInt(iFile,"Auto_Login",0);
        INI_Close(iFile);
        pLogged[playerid] = 1;
        new iStr[128];
        format(iStr,sizeof(iStr),"You've successfully registered with the password \"%s\".",inputtext);
        SendClientMessage(playerid,yellow,iStr);
        return 1;
    }
    if(dialogid == DIALOG_LOGIN)
    {
        if(!response) Kick(playerid);
        new iStr[128],gTries;
        if(gTries == 0) gTries = 1;
        if(gTries == 3)
        {
            new pName[30];
            GetPlayerName(playerid,pName,sizeof(pName));
            format(iStr,sizeof(iStr),"%s has been kicked for exceeding login tries.",pName);
            SendClientMessageToAll(red,iStr);
            return Kick(playerid);
        }
        if(!strlen(inputtext))
        {
            format(iStr,sizeof(iStr),"Please enter your password. Tries: %i/3",gTries);
            return ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login",iStr,"Login","Leave");
        }
        if(udb_hash(inputtext) == pInfo[playerid][Pass])
        {
            pLogged[playerid] = 1;
            SendClientMessage(playerid,lime,"You've successfully logged in.");
            SetPlayerScore(playerid,pInfo[playerid][Score]);
            GivePlayerMoney(playerid,pInfo[playerid][Cash]);
        } else {
            format(iStr,sizeof(iStr),"Incorrect password. Tries: %i/3",gTries);
            ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Register",iStr,"Login","Leave");
            gTries++;
            return 1;
        }
        return 1;
    }
    if(dialogid == CALLSIGN_DIALOG)
    {
        if(strlen(inputtext))
        {
            new INI:iFile = INI_Open(PlayerPath(playerid));
            INI_SetTag(iFile,"data");
            INI_WriteInt(iFile,"Callsign",strval(inputtext));
            INI_Close(iFile);
        }
        return 1;
    }
    return 0;
}
//================================================================== [StandardCMDS] ==========================================================//
dcmd_PM(playerid, params[])
{
    new id, message, pmstring1[128], pmstring2[128];
    if(sscanf(params, "ui", id, message)) return SendClientMessage(playerid, RED,"USAGE:{FFFF00}/PM [playerid] [Message]");
    if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, RED,"ERROR Player Specified is Offline");
    if(id == playerid) return SendClientMessage(playerid, RED,"You can't PM yourself"); // Optional
    {
        format(pmstring1, sizeof(pmstring1),"[PM Message Recived From %s] %s", PlayerName2(playerid), message);
        SendClientMessage(id, Yellow, pmstring1);
        format(pmstring2, sizeof(pmstring2),"[PM Message Sent To %s] %s", PlayerName2(id), message);
        SendClientMessage(playerid, Yellow, pmstring2);
    }
    return 1;
}
dcmd_Loc(playerid, params[])
{
    new id;
    if(sscanf(params, "u", id)) return SendClientMessage(playerid, RED, "USAGE:{FFFF00}/loc [id]");
    if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, RED,"ERROR Player Specified is Offline");
    if(id == playerid) return SendClientMessage(playerid, RED,"You can't Locate Yourself");
    {
        new r[128], zone[128];
        GetPlayer2DZone(id, zone, sizeof(zone));
        format(r, sizeof(r),"Player %s Is in %s", PlayerName2(id), zone);
        SendClientMessage(playerid, Yellow, r);
    }
    return 1;
}
dcmd_AFK(playerid, params[])
{
    new string[128], afkreason[50];
    if(sscanf(params, "s[128]", afkreason)) return SendClientMessage(playerid, RED,"USAGE:{FFFF00}/afk [Reason]");
    if(!strlen(afkreason))
    if(pAFK[playerid] == 0)
    {
        format(string, sizeof(string),"%s is not AFK [No Reason Given]", PlayerName2(playerid));
        SendClientMessageToAll(Yellow, string);
        pAFK[playerid] = 1;
    }
    else
    {
        format(string, sizeof(string),"%s is now AFK [Reason: %s]", PlayerName2(playerid), afkreason);
        SendClientMessageToAll(Yellow, string);
        pAFK[playerid] = 1;
    }
    else if(pAFK[playerid] == 1)
    {
        format(string, sizeof(string),"%s is now back from %s", PlayerName2(playerid), afkreason);
        SendClientMessageToAll(Yellow, string);
        pAFK[playerid] = 0;
    }
    return 1;
}
dcmd_AFKList(playerid, params[])
{
    new count = 0;
    new string[128];
    #pragma unused params

    SendClientMessage(playerid, Green, " ");
    SendClientMessage(playerid, Green, "___________ |- Current AFK Players -| ___________");
    SendClientMessage(playerid, Green, " ");

    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(pAFK[i] == 1)
            {
                count++;
                GetPlayerName(i, pAFK, sizeof(pAFK));
                format(string, sizeof(string), "%s\n", pAFK);
                SendClientMessage(playerid, Yellow, string);
                SendClientMessage(playerid, Green, " ");
                SendClientMessage(playerid, Green, "_____________________________________________");
            }
        }
    }
    if(count == 0)
    {
        SendClientMessage(playerid, Yellow,"No one is AFK here buddy.");
        SendClientMessage(playerid, Green, " ");
        SendClientMessage(playerid, Green, "_____________________________________________");
        SendClientMessage(playerid, Green, " ");
    }
    return 1;
}
dcmd_Admins(playerid, params[])
{
    new count = 0;
    new string[128];
    #pragma unused params
   
    SendClientMessage(playerid, Green, " ");
    SendClientMessage(playerid, Green, "___________ |- Current Online Admins -| ___________");
    SendClientMessage(playerid, Green, " ");
   
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(pInfo[i][AdminLevel] == 1)
            {
                count++;
                new name[24];
                GetPlayerName(i, name, sizeof(name));
                format(string, sizeof(string), "%s [LVL %d][Rank: Junior Modorator]\n", name, pInfo[i][AdminLevel]);
                SendClientMessage(playerid, Yellow, string);
                SendClientMessage(playerid, Green, " ");
                SendClientMessage(playerid, Green, "________________________________________________");
            }
            if(pInfo[i][AdminLevel] == 2)
            {
                count++;
                new name[24];
                GetPlayerName(i, name, sizeof(name));
                format(string, sizeof(string), "%s [LVL %d][Rank: Modorator]\n", name, pInfo[i][AdminLevel]);
                SendClientMessage(playerid, Yellow, string);
                SendClientMessage(playerid, Green, " ");
                SendClientMessage(playerid, Green, "________________________________________________");
            }
            if(pInfo[i][AdminLevel] == 3)
            {
                count++;
                new name[24];
                GetPlayerName(i, name, sizeof(name));
                format(string, sizeof(string), "%s [LVL %d][Rank: Super Moderator]\n", name, pInfo[i][AdminLevel]);
                SendClientMessage(playerid, Yellow, string);
                SendClientMessage(playerid, Green, " ");
                SendClientMessage(playerid, Green, "________________________________________________");
            }
            if(pInfo[i][AdminLevel] == 4)
            {
                count++;
                new name[24];
                GetPlayerName(i, name, sizeof(name));
                format(string, sizeof(string), "%s [LVL %d][Rank: Junior Admin]\n", name, pInfo[i][AdminLevel]);
                SendClientMessage(playerid, Yellow, string);
                SendClientMessage(playerid, Green, " ");
                SendClientMessage(playerid, Green, "________________________________________________");
            }
            if(pInfo[i][AdminLevel] == 5)
            {
                count++;
                new name[24];
                GetPlayerName(i, name, sizeof(name));
                format(string, sizeof(string), "%s [LVL %d][Rank: Super Admin]\n", name, pInfo[i][AdminLevel]);
                SendClientMessage(playerid, Yellow, string);
                SendClientMessage(playerid, Green, " ");
                SendClientMessage(playerid, Green, "________________________________________________");
            }
            if(pInfo[i][AdminLevel] == 6)
            {
                count++;
                new name[24];
                GetPlayerName(i, name, sizeof(name));
                format(string, sizeof(string), "%s [LVL %d][Rank: Head Admin]\n", name, pInfo[i][AdminLevel]);
                SendClientMessage(playerid, Yellow, string);
                SendClientMessage(playerid, Green, " ");
                SendClientMessage(playerid, Green, "________________________________________________");
            }
            if(pInfo[i][AdminLevel] == 1335)
            {
                count++;
                new name[24];
                GetPlayerName(i, name, sizeof(name));
                format(string, sizeof(string), "%s [LVL %d][Rank: Co-Co-Owner]\n", name, pInfo[i][AdminLevel]);
                SendClientMessage(playerid, Yellow, string);
                SendClientMessage(playerid, Green, " ");
                SendClientMessage(playerid, Green, "________________________________________________");
            }
            if(pInfo[i][AdminLevel] == 1336)
            {
                count++;
                new name[24];
                GetPlayerName(i, name, sizeof(name));
                format(string, sizeof(string), "%s [LVL %d][Rank: Co-Owner]\n", name, pInfo[i][AdminLevel]);
                SendClientMessage(playerid, Yellow, string);
                SendClientMessage(playerid, Green, " ");
                SendClientMessage(playerid, Green, "________________________________________________");
            }
            if(pInfo[i][AdminLevel] == 1337)
            {
                count++;
                new name[24];
                GetPlayerName(i, name, sizeof(name));
                format(string, sizeof(string), "%s [LVL %d][Rank: Owner]\n", name, pInfo[i][AdminLevel]);
                SendClientMessage(playerid, Yellow, string);
                SendClientMessage(playerid, Green, " ");
                SendClientMessage(playerid, Green, "________________________________________________");
            }
        }
    }
    if(count == 0)
    {
        SendClientMessage(playerid, Yellow,"No Admins online right now buddy.");
        SendClientMessage(playerid, Green, " ");
        SendClientMessage(playerid, Green, "_______________________________________________");
        SendClientMessage(playerid, Green, " ");
    }
    return 1;
}
dcmd_Report(playerid, params[])
{
    new Player, Reason;
    if(sscanf(params, "ui", Player, Reason)) return SendClientMessage(playerid, RED,"USAGE: {FFFF00}/Report [PlayerID] [Reason]");
    if(Player == playerid) return SendClientMessage(playerid, RED,"You can't crash yourself"); // Optional
   
    if(IsPlayerConnected(Player))
    {
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
                if(pOnDuty[i] == 1)
                {
                    FormatMSG(i, ABLUE, "You Have Been sent a report on %s by %s Reason %s", PlayerName2(Player), PlayerName2(playerid), Reason);
                    FormatMSG(playerid, ABLUE, "You Have sent a report on %s to %s Reason %s", PlayerName2(Player), PlayerName2(i), Reason);
                    pReport[Player] = 1;
                }
            }
            else return SendClientMessage(playerid, RED,"ERROR Admin Specified Not Online!");
        }
    }
    else return SendClientMessage(playerid, RED,"ERROR Player Specified Not Online!");
    return 1;
}
dcmd_callsign(playerid, params[])
{
    #pragma unused params
    new PDialogstring[200];
    format(PDialogstring, sizeof(PDialogstring), "Callsign: %s", pInfo[playerid][Callsign]);
    ShowPlayerDialog(playerid, CALLSIGN_DIALOG, DIALOG_STYLE_LIST, "Callsign", PDialogstring, "OK", "Cancel");
}
//================================================================== [AdminCMDS] ===========================================================//
dcmd_SetLevel(playerid, params[])
{
    if(!(pInfo[playerid][AdminLevel] >= 10)) return SendClientMessage( playerid, RED, "ERROR: You need to be administrator to use this command!" );
    new Player, aLevel;
    if(sscanf(params, "ui", Player, aLevel)) return SendClientMessage(playerid, RED,"USAGE: {FFFF00}/SetLevel [PlayerID] [Admin Level]");
    if(aLevel < 1 || aLevel > 1337 ) return SendClientMessage(playerid, RED, "ERROR: Invalid level! Max admin level you can set is 1337 and the minimum admin u can set it 1!");

    if(IsPlayerConnected(Player))
    {
        new INI:iFile = INI_Open(PlayerPath(playerid));
        FormatMSG(Player, ABLUE, "Welcome To The Pilots Heaven Team %s has set your Level to %d", PlayerName2(playerid), aLevel);
        FormatMSG(playerid, ABLUE, "You Have Set %s's Admin Level to %d", PlayerName2(Player), aLevel);
        INI_SetTag(iFile,"data");
        INI_WriteInt(iFile,"AdminLevel",strval(params[1]));
        INI_Close(iFile);
    }
    else return SendClientMessage(playerid, RED,"ERROR Player Specified Not Online!");
    return 1;
}
dcmd_SetVIPLevel(playerid, params[])
{
    if(!(pInfo[playerid][AdminLevel] >= 10)) return SendClientMessage( playerid, RED, "ERROR: You need to be administrator to use this command!" );
    new Player, vLevel;
    if(sscanf(params, "ui", Player, vLevel)) return SendClientMessage(playerid, RED,"USAGE: {FFFF00}/SetVIPLevel [PlayerID] [VIP Level]");
    if(vLevel > 10 ) return SendClientMessage(playerid, RED, "ERROR: Invalid level! Max VIP level you can set is 10!");

    if(IsPlayerConnected(Player))
    {
        new INI:iFile = INI_Open(PlayerPath(playerid));
        FormatMSG(Player, ABLUE, "%s has set you VIP Level to %d", PlayerName2(playerid), vLevel);
        FormatMSG(playerid, ABLUE, "You have set %s's level to %d", PlayerName2(Player), vLevel);
        INI_SetTag(iFile,"data");
        INI_WriteInt(iFile,"VIPLevel",strval(params[1]));
        INI_Close(iFile);
    }
    else return SendClientMessage(playerid, RED,"ERROR Player Specified Not Online!");
    return 1;
}
dcmd_SetScore(playerid, params[])
{
    new id, score;
    if(!(pInfo[playerid][AdminLevel] >=10)) return SendClientMessage( playerid, RED, "ERROR: You need to be administrator to use this command!" );
    if(sscanf(params, "us[128]", id, score)) return SendClientMessage(playerid, RED, "USAGE: {FFFF00}/SetScore [playerid] [Score]");
    if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, RED,"ERROR Player Specified is Offline");
    {
        FormatMSG(id, Yellow, "You Score has been set to %d by %s", score, PlayerName2(playerid));
        FormatMSG(id, Yellow, "You have set %s's score to %d", PlayerName2(playerid), score);
        SetPlayerScore(id, score);
    }
    return 1;
}
dcmd_Crash(playerid, params[])
{
    new string[128], id, reason[50];
    if(!(pInfo[playerid][AdminLevel] >= 4)) return SendClientMessage( playerid, RED, "ERROR: You need to be administrator to use this command!" );
    if(sscanf(params, "us[128]", id, reason)) return SendClientMessage(playerid, RED,"USAGE: {FFFF00}/Crash [playerid] [reason]");
    if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, RED,"ERROR Player Specified is Offline");
    if(id == playerid) return SendClientMessage(playerid, RED,"You can't crash yourself"); // Optional
    if(!strlen(reason))
    {
        format(string, sizeof(string),"%s Has been crashed by Admin %s [no reason given]",PlayerName2(id),PlayerName2(playerid));
        SendClientMessageToAll(ABLUE, string);
        GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 1000, 0);
        GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 2000, 1);
        GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 3000, 2);
        GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 4000, 3);
        GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 5000, 4);
        GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 6000, 5);
        GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 7000, 6);
    }
    else
    {
        format(string, sizeof(string),"%s has been crashed by Admin %s [Reason: %s]",PlayerName2(id), PlayerName2(playerid), reason);
        SendClientMessageToAll(ABLUE, string);
        GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 1000, 0);
        GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 2000, 1);
        GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 3000, 2);
        GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 4000, 3);
        GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 5000, 4);
        GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 6000, 5);
        GameTextForPlayer(id, "•¤¶§!$$%&'()*+,-./01~!@#$^&*()_-+={[}]:;'<,>.?/", 7000, 6);
    }
    return 1;
}
dcmd_Ban(playerid, params[])
{
    new string[128], id, reason[50];
    if(!(pInfo[playerid][AdminLevel] >= 4)) return SendClientMessage( playerid, RED, "ERROR: You need to be administrator to use this command!" );
    if(sscanf(params, "us[128]", id, reason)) return SendClientMessage(playerid, RED,"USAGE: {FFFF00}/ban [playerid] [reason]");
    if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, RED,"ERROR Player Specified is Offline");
    if(id == playerid) return SendClientMessage(playerid, RED,"You can't ban yourself"); // Optional
    if(!strlen(reason))
    {
        new INI:iFile = INI_Open(PlayerPath(playerid));
        format(string, sizeof(string),"%s Has been Banned by Admin %s [no reason given]",PlayerName2(id),PlayerName2(playerid));
        SendClientMessageToAll(ABLUE, string);
        INI_SetTag(iFile,"data");
        INI_WriteInt(iFile,"Banned", 1);
        INI_Close(iFile);
        pBanned[id] = 1;
        Kick(id);
    }
    else
    {
        new INI:iFile = INI_Open(PlayerPath(playerid));
        format(string, sizeof(string),"%s has been Banned by Admin %s [Reason: %s]",PlayerName2(id), PlayerName2(playerid), reason);
        SendClientMessageToAll(ABLUE, string);
        INI_SetTag(iFile,"data");
        INI_WriteInt(iFile,"Banned", 1);
        INI_Close(iFile);
        pBanned[id] = 1;
        Kick(id);
    }
    return 1;
}
dcmd_Announce(playerid, params[])
{
    new Message[128];
    if(!(pInfo[playerid][AdminLevel] >= 1)) return SendClientMessage( playerid, RED, "ERROR: You need to be administrator to use this command!" );
    if(sscanf(params, "s[128]", Message)) return SendClientMessage( playerid, RED, "USAGE: {FFFF00}/announce [Message]" );
    {
        GameTextForAll(Message, 6000, 4);
    }
    return 1;
}
dcmd_Kick(playerid, params[])
{
    new string[128], id, reason[50];
    if(!(pInfo[playerid][AdminLevel] >= 4)) return SendClientMessage(playerid, RED, "ERROR: You need to be administrator to use this command!" );
    if(sscanf(params, "us[128]", id, reason)) return SendClientMessage(playerid, RED,"USAGE: {FFFF00}/Kick [playerid] [reason]");
    if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, RED,"ERROR Player Specified is Offline");
    if(id == playerid) return SendClientMessage(playerid, RED,"You can't ban yourself"); // Optional
    if(!strlen(reason))
    {
        format(string, sizeof(string),"%s Has been kicked by Admin %s [no reason given]",PlayerName2(id),PlayerName2(playerid));
        SendClientMessageToAll(ABLUE, string);
        Kick(id);
    }
    else
    {
        format(string, sizeof(string),"%s Has been kicked by Admin %s [Reason: %s]",PlayerName2(id),PlayerName2(playerid), reason);
        SendClientMessageToAll(ABLUE, string);
        Kick(id);
    }
    return 1;
}
dcmd_Vehicle(playerid, params[])
{
    new string[128];
    new Float:X, Float:Y, Float:Z, Float:A;
    new MODEL, COL1, COL2;
    new Admin_Car;
    if(!(pInfo[playerid][AdminLevel] >=2)) return SendClientMessage(playerid, RED, "ERROR: You need to be administrator to use this command!" );
    if(sscanf(params, "ddd", MODEL, COL1, COL2)) return SendClientMessage(playerid, RED,"USAGE: {FFFF00}/Vehicle [modelid] [Color1] [Color2]");
    {
        GetPlayerPos(playerid, X, Y, Z);
        GetPlayerFacingAngle(playerid, A);
        format(string, sizeof(string), "You Have Spawned a car. Model ID: %d Color 1: %d Color 2: %d", MODEL, COL1, COL2);
        SendClientMessage(playerid, ABLUE, string);
        Admin_Car = CreateVehicle(MODEL, X, Y, Z, A, COL1, COL2, 60);
        PutPlayerInVehicle(playerid, Admin_Car, 0);
        SetVehicleNumberPlate(Admin_Car, "Admin_Car");
    }
    return 1;
}
dcmd_Aduty(playerid, params[])
{
    #pragma unused params
    new string[128];
    new string1[128];
    new Text3D:label[MAX_PLAYERS];
    if(!(pInfo[playerid][AdminLevel])) return SendClientMessage(playerid, RED, "ERROR: You Need to be administrator to use this command!");
    if(pOnDuty[playerid] == 0)
    {
        format(string, sizeof(string),"%s is now on Admin Duty DONT ATTACK!!!!!", PlayerName2(playerid));
        SendClientMessageToAll(ABLUE, string);
        format(string1, sizeof(string1),"%s [LVL %d] is on admin duty", PlayerName2(playerid), pInfo[playerid][AdminLevel]);
        label[playerid] = Create3DTextLabel(string1, 0x008080FF, 30.0, 40.0, 50.0, 40.0, 0);
        Attach3DTextLabelToPlayer(label[playerid], playerid, 0.0, 0.0, 0.7);
    }
    else if(pOnDuty[playerid] == 1)
    {
        format(string, sizeof(string),"%s is now off Admin Duty And Enjoys the game", PlayerName2(playerid));
        SendClientMessageToAll(ABLUE, string);
        Delete3DTextLabel(label[playerid]);
    }
    return 1;
}
dcmd_Hide(playerid, params[])
{
    #pragma unused params
    if(!(pInfo[playerid][AdminLevel])) return SendClientMessage(playerid, RED, "ERROR: You Need to be administrator to use this command!");
    {
        SendClientMessage(playerid,ABLUE,"You are hidden from the online admins list");
        pOnDuty[playerid] = 0;
    }
    return 1;
}
dcmd_Show(playerid, params[])
{
    #pragma unused params
    if(!(pInfo[playerid][AdminLevel])) return SendClientMessage(playerid, RED, "ERROR: You Need to be administrator to use this command!");
    {
        SendClientMessage(playerid,ABLUE,"You are no longer hidden from the online admins list");
        pOnDuty[playerid] = 1;
    }
    return 1;
}
//================================================================== [ STOCKS ] ===========================================================//
stock PlayerName2( i )
{
    new n[ 24 ];
    GetPlayerName( i, n, 24 );
    return n;
}

forward GetPlayerAVSAdmin(playerid);
public GetPlayerAVSAdmin(playerid)
{
    return pInfo[playerid][AdminLevel];
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(PM, 2, cmdtext);
    dcmd(Loc, 3, cmdtext);
    dcmd(AFK, 3, cmdtext);
    dcmd(AFKList, 7, cmdtext);
    dcmd(SetLevel, 8, cmdtext);
    dcmd(SetVIPLevel, 11, cmdtext);
    dcmd(Crash, 5, cmdtext);
    dcmd(Ban, 3, cmdtext);
    dcmd(Announce, 8, cmdtext);
    dcmd(Kick, 4, cmdtext);
    dcmd(Aduty, 5, cmdtext);
    dcmd(Admins, 6, cmdtext);
    dcmd(Vehicle, 7, cmdtext);
    dcmd(Hide, 4, cmdtext);
    dcmd(Show, 4, cmdtext);
    dcmd(Report, 6, cmdtext);
    dcmd(SetScore, 8, cmdtext);
    dcmd(callsign, 8, cmdtext);
    return 0;
}
FINISH!


Re: script crashing my Pawno - aRoach - 10.10.2011

Pastebin !

FINISH !


Re: script crashing my Pawno - Zonoya - 10.10.2011

thx its fixed now xD