Error in CMD:admins
#1

Code:
C:\Users\Matt\Desktop\SAMP\Racing\pracing\gamemodes\phi.racing.pwn(27960) : warning 217: loose indentation
C:\Users\Matt\Desktop\SAMP\Racing\pracing\gamemodes\phi.racing.pwn(27971) : warning 217: loose indentation
C:\Users\Matt\Desktop\SAMP\Racing\pracing\gamemodes\phi.racing.pwn(27976) : warning 217: loose indentation
C:\Users\Matt\Desktop\SAMP\Racing\pracing\gamemodes\phi.racing.pwn(27976) : error 029: invalid expression, assumed zero
C:\Users\Matt\Desktop\SAMP\Racing\pracing\gamemodes\phi.racing.pwn(27976) : error 017: undefined symbol "cmd_acar"
C:\Users\Matt\Desktop\SAMP\Racing\pracing\gamemodes\phi.racing.pwn(27976) : error 029: invalid expression, assumed zero
C:\Users\Matt\Desktop\SAMP\Racing\pracing\gamemodes\phi.racing.pwn(27976) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
pawn Code:
CMD:admins(playerid, params[])
{
        SendCommandToAdmins(playerid,"/admins");
        new count = 0;
        new AdminString[1500];
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if (IsPlayerConnected(i))
            {
                if(PlayerInfo[i][AdminLevel] >= 1)
                {
                    if(IsPlayerAdmin(i))
                    {
                        AdmRank = "{FF0000}RCON {FFFFFF}Administrator";
                    }
                    else
                    {
                        switch(PlayerInfo[i][AdminLevel])
                        {
                            case 1:
                            {
                                AdmRank = "{00FF00}Helper {FFFFFF}Moderator";
                            }
                            case 2:
                            {
                                AdmRank = "{FFFFFF}Trial {FF0000}Modetator";
                            }
                            case 3:
                            {
                                AdmRank = "{FF0000}Moderator";
                            }
                            case 4:
                            {
                                AdmRank = "{FF0000}Adminitrator";
                            }
                            case 5:
                            {
                                AdmRank = "{FFFFFF}Head Administrator";
                            }
                            case 6:
                            {
                                AdmRank = "{FFFFFF}Manager";
                            }
                            case 7:
                            {
                                AdmRank = "{FFFFFF}Server Owner";
                            }
                           
                    }
                    new file[300];
                    new name[MAX_PLAYER_NAME];
                    GetPlayerName(i, name, sizeof(name));
                    format(file,sizeof(file),"ServerData/Users/%s.ini",name);
                    PlayerInfo[i][AdminLevel] = dini_Int(file, "AdminLevel");
                    format(AdminString, sizeof(AdminString), "%s{FF00FF}Level: {FF0000}%d {FF00FF}- {00FF00}%s (Id:{FF0000}%i{00FF00}) {FF00FF}| %s \n",AdminString, PlayerInfo[i][AdminLevel], PlayerName2(i),i,AdmRank);
                    ShowPlayerDialog(playerid, DIALOG_ADMINS, DIALOG_STYLE_MSGBOX, "[!] Online Admins", AdminString, "OK", "");
                    count++;
                }
            }
        }
        if (count == 0)
        {
            ShowPlayerDialog(playerid, DIALOG_ADMINS, DIALOG_STYLE_MSGBOX, "[!] Online Admins", "No online admins", "OK", "");
        }
}
CMD:acar(playerid, params[])
{
    if(PlayerInfo[playerid][AdminLevel] >= 1)
    {
        if(PlayerInfo[playerid][World] == DMWorldID) return SendClientMessage(playerid, COLOR_RED, "ERROR: You cannot use vehicle in the Deathmatch World");
        if(PlayerInfo[playerid][World] == TDMWorldID) return SendClientMessage(playerid, COLOR_RED, "ERROR: You cannot use this command in this World");
        if(IsPlayerInAnyVehicle(playerid)) DestroyVehicle(GetPlayerVehicleID(playerid));
        new Float:x, Float:y, Float:z, Float:angle, world, interior, VehicleID;
        GetPlayerPos(playerid, x, y, z);
        world = GetPlayerVirtualWorld(playerid);
        interior = GetPlayerInterior(playerid);
        GetPlayerFacingAngle(playerid, angle);
        VehicleID = CreateVehicle(411, x, y, z, angle, -1, -1, 60);
        LinkVehicleToInterior(VehicleID, interior);
        SetVehicleVirtualWorld(VehicleID, world);
        PutPlayerInVehicle(playerid, VehicleID, 0);
        SendCommandToAdmins(playerid,"/acar");
    }
    else return SendClientMessage(playerid, COLOR_RED, "ERROR: You must be Administrator Level 1 to use this Command!");
    return 1;
}
Reply
#2

Show me Line 27976.
Reply
#3

Quote:
Originally Posted by iFarbod
View Post
Show me Line 27976.
CMD:acar(playerid, params[])
Reply
#4

Change
pawn Code:
CMD:acar(playerid, params[])
{
    if(PlayerInfo[playerid][AdminLevel] >= 1)
    {
        if(PlayerInfo[playerid][World] == DMWorldID) return SendClientMessage(playerid, COLOR_RED, "ERROR: You cannot use vehicle in the Deathmatch World");
        if(PlayerInfo[playerid][World] == TDMWorldID) return SendClientMessage(playerid, COLOR_RED, "ERROR: You cannot use this command in this World");
        if(IsPlayerInAnyVehicle(playerid)) DestroyVehicle(GetPlayerVehicleID(playerid));
        new Float:x, Float:y, Float:z, Float:angle, world, interior, VehicleID;
        GetPlayerPos(playerid, x, y, z);
        world = GetPlayerVirtualWorld(playerid);
        interior = GetPlayerInterior(playerid);
        GetPlayerFacingAngle(playerid, angle);
        VehicleID = CreateVehicle(411, x, y, z, angle, -1, -1, 60);
        LinkVehicleToInterior(VehicleID, interior);
        SetVehicleVirtualWorld(VehicleID, world);
        PutPlayerInVehicle(playerid, VehicleID, 0);
        SendCommandToAdmins(playerid,"/acar");
    }
    else return SendClientMessage(playerid, COLOR_RED, "ERROR: You must be Administrator Level 1 to use this Command!");
    return 1;
}
TO

pawn Code:
CMD:acar(playerid, params[])
{
    if(!PlayerInfo[playerid][AdminLevel]) return SendClientMessage(playerid, COLOR_RED, "ERROR: You must be Administrator Level 1 to use this Command!");
    if(PlayerInfo[playerid][World] == DMWorldID) return SendClientMessage(playerid, COLOR_RED, "ERROR: You cannot use vehicle in the Deathmatch World");
    if(PlayerInfo[playerid][World] == TDMWorldID) return SendClientMessage(playerid, COLOR_RED, "ERROR: You cannot use this command in this World");
    if(IsPlayerInAnyVehicle(playerid)) DestroyVehicle(GetPlayerVehicleID(playerid));
    new Float:x, Float:y, Float:z, Float:angle, world, interior, VehicleID;
    GetPlayerPos(playerid, x, y, z);
    world = GetPlayerVirtualWorld(playerid);
    interior = GetPlayerInterior(playerid);
    GetPlayerFacingAngle(playerid, angle);
    VehicleID = CreateVehicle(411, x, y, z, angle, -1, -1, 60);
    LinkVehicleToInterior(VehicleID, interior);
    SetVehicleVirtualWorld(VehicleID, world);
    PutPlayerInVehicle(playerid, VehicleID, 0);
    SendCommandToAdmins(playerid,"/acar");
    return 1;
}
Tell me if i helped.
Reply
#5

one thing

when i add the cmd:admins
the errors appeared but when i comments those codes it apprears no errors i don't know why?
Reply
#6

Quote:

new AdminString[1500];

Do you know what you do? I Suggest to make a Message based /admins. I Have this one done one month ago, i share it with you because it can help.

pawn Code:
ICMD:admins(playerid, params[])
{
    new
        str[90];

    if(!CountOnlineAdmins()) return SCM(playerid, ICLR_DANGER, "There aren't any online admins at this time.");
    SCM(playerid, FWTC_PALEVIOLETRED, "*** Online Admins ***");
    format(str, sizeof(str), "* There are %d admin(s) online.", CountOnlineAdmins());
    SCM(playerid, FWTC_YELLOWGREEN, str);
   
    for(new i = 0; i != MAX_PLAYERS; ++i)
    {
        if(IsPlayerConnected(i) && pInfo[i][pAdminLevel])
        {
            format(str, sizeof(str), IE_PRIMARY "* Level %d [%s] : %s", pInfo[i][pAdminLevel], GetPlayerAdminLevel(i), PlayerNameEx(i));
            SCM(playerid, -1, str);
        }
    }
    return 1;
}
Reply
#7

i will try that one

anymore comments are welcome
Reply
#8

Take these functions, if you want:

pawn Code:
stock PlayerNameEx(playerid) // returns the name like : iFarbod (7)
{
    new
        playerName[MAX_PLAYER_NAME+1],
        string[MAX_PLAYER_NAME+1+7];

    GetPlayerName(playerid, playerName, sizeof(playerName));
    format(string, sizeof(string), "%s (%d)", playerName, playerid);
    return string;
}

stock CountOnlineAdmins(level = 1)
{
    new
        onlineAdmins;
    for(new i = 0; i != MAX_PLAYERS; ++i)
    {
        if(IsPlayerConnected(i)) && pInfo[i][pAdmin] >= level) onlineAdmins++;
    }
    return onlineAdmins;
}
Reply
#9

Try this one. You missed a bracket. By the way, if you already have the Admin Level stored in a variable, why are you reading it again from the file?
pawn Code:
CMD:admins(playerid, params[])
{
    SendCommandToAdmins(playerid,"/admins");
    new count = 0;
    new AdminString[1500];
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if (IsPlayerConnected(i))
        {
            if(PlayerInfo[i][AdminLevel] >= 1)
            {
                if(IsPlayerAdmin(i))
                {
                    AdmRank = "{FF0000}RCON {FFFFFF}Administrator";
                }
                else
                {
                    switch(PlayerInfo[i][AdminLevel])
                    {
                        case 1:
                        {
                            AdmRank = "{00FF00}Helper {FFFFFF}Moderator";
                        }
                        case 2:
                        {
                            AdmRank = "{FFFFFF}Trial {FF0000}Modetator";
                        }
                        case 3:
                        {
                            AdmRank = "{FF0000}Moderator";
                        }
                        case 4:
                        {
                            AdmRank = "{FF0000}Adminitrator";
                        }
                        case 5:
                        {
                            AdmRank = "{FFFFFF}Head Administrator";
                        }
                        case 6:
                        {
                            AdmRank = "{FFFFFF}Manager";
                        }
                        case 7:
                        {
                            AdmRank = "{FFFFFF}Server Owner";
                        }
                    }  
                }
                new file[300];
                new name[MAX_PLAYER_NAME];
                GetPlayerName(i, name, sizeof(name));
                format(AdminString, sizeof(AdminString), "%s{FF00FF}Level: {FF0000}%d {FF00FF}- {00FF00}%s (Id:{FF0000}%i{00FF00}) {FF00FF}| %s \n",AdminString, PlayerInfo[i][AdminLevel], PlayerName2(i),i,AdmRank);
                count++;
            }
        }
    }
    if (count == 0)
    {
        ShowPlayerDialog(playerid, DIALOG_ADMINS, DIALOG_STYLE_MSGBOX, "[!] Online Admins", "No online admins", "OK", "");
    }
    else
    {
        ShowPlayerDialog(playerid, DIALOG_ADMINS, DIALOG_STYLE_MSGBOX, "[!] Online Admins", AdminString, "OK", "");
    }
    return 1;
}
CMD:acar(playerid, params[])
{
    if(PlayerInfo[playerid][AdminLevel] >= 1)
    {
        if(PlayerInfo[playerid][World] == DMWorldID) return SendClientMessage(playerid, COLOR_RED, "ERROR: You cannot use vehicle in the Deathmatch World");
        if(PlayerInfo[playerid][World] == TDMWorldID) return SendClientMessage(playerid, COLOR_RED, "ERROR: You cannot use this command in this World");
        if(IsPlayerInAnyVehicle(playerid)) DestroyVehicle(GetPlayerVehicleID(playerid));
        new Float:x, Float:y, Float:z, Float:angle, world, interior, VehicleID;
        GetPlayerPos(playerid, x, y, z);
        world = GetPlayerVirtualWorld(playerid);
        interior = GetPlayerInterior(playerid);
        GetPlayerFacingAngle(playerid, angle);
        VehicleID = CreateVehicle(411, x, y, z, angle, -1, -1, 60);
        LinkVehicleToInterior(VehicleID, interior);
        SetVehicleVirtualWorld(VehicleID, world);
        PutPlayerInVehicle(playerid, VehicleID, 0);
        SendCommandToAdmins(playerid,"/acar");
    }
    else return SendClientMessage(playerid, COLOR_RED, "ERROR: You must be Administrator Level 1 to use this Command!");
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)