GPS command, 4 errors..
#1

The command:
pawn Код:
//==============================================================================
// GPS
//==============================================================================

CMD:gps(playerid,params[]) {

    if(PlayerInfo[playerid][Level] >= 3)
    return SendClientMessage(playerid,red,"ERROR: You need to be Level 3 to use this Command");

    if(PlayerInfo[playerid][SpecType] != ADMIN_SPEC_TYPE_NONE)
    return SendClientMessage(playerid, red, "ERROR: First Disable the Spectating System! (/lspecoff)");

    if(!strlen(params))
    return SendClientMessage(playerid,LIGHTBLUE2, "Usage: /gps [PlayerID/Off]") &&
    SendClientMessage(playerid, orange, "Function: Will enable GPS do find a specified Player (If you are in a race, do not use)");

    if(strcmp(params,"off",true) == 0)
    {
        GameTextForPlayer(playerid,"~w~Gps ~r~Off!",3000,3);
Line 14717:IsDisable[playerid] = 0;
        PlayerInfo[playerid][pGps] = -1;
        return 1;
    }
    new player1;
    new string2[128];
    player1 = strval(params);
    if(player1 == playerid)
    return SendClientMessage(playerid,red,"ERROR: You can not Find yourself!");

    if(PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel])
    return SendClientMessage(playerid,red,"ERROR: You can not localize an Administrator!");

    if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
    {
        new playername[MAX_PLAYER_NAME];
        GetPlayerName(player1, playername, sizeof(playername));
        format(string2, sizeof(string2),"<LuxGps> System Enabled in the Player - '%s'", playername);
        SendClientMessage(playerid, 0xDC686BAA, string2);
        GameTextForPlayer(playerid,"~w~Gps ~g~On!",3000,3);
        PlayerInfo[playerid][pGps] = player1;
        }
    else return SendClientMessage(playerid,red,"ERROR: Player is not connected);
    return 1;
    }
The Errors:
pawn Код:
C:\Users\Ole Kristian\Desktop\San Andreas Server\gamemodes\SATDM~RP.pwn(14717) : error 028: invalid subscript (not an array or too many subscripts): "IsDisable"
C:\Users\Ole Kristian\Desktop\San Andreas Server\gamemodes\SATDM~RP.pwn(14717) : warning 215: expression has no effect
C:\Users\Ole Kristian\Desktop\San Andreas Server\gamemodes\SATDM~RP.pwn(14717) : error 001: expected token: ";", but found "]"
C:\Users\Ole Kristian\Desktop\San Andreas Server\gamemodes\SATDM~RP.pwn(14717) : error 029: invalid expression, assumed zero
C:\Users\Ole Kristian\Desktop\San Andreas Server\gamemodes\SATDM~RP.pwn(14717) : fatal error 107: too many error messages on one line

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


4 Errors.
Reply
#2

Is it an FS? Or an include? Or a custom script? You mind posting the whole script to understand it properly. It hards to fix these issues without the whole script?
Reply
#3

try putting { after comand and close it at end }
Reply
#4

Do you have the variable IsDisable defined at the beggining of your script and also indexed?

pawn Код:
new IsDisable[MAX_PLAYERS];
I guess it's a noob question,but your code looks fine to me,so it's the only problem I could came up with...
Reply
#5

Quote:
Originally Posted by Cjgogo
Посмотреть сообщение
Do you have the variable IsDisable defined at the beggining of your script and also indexed?

pawn Код:
new IsDisable[MAX_PLAYERS];
I guess it's a noob question,but your code looks fine to me,so it's the only problem I could came up with...
I agree to that. The subscript is showing the error in the array! What else it can be
Reply
#6

The command and the system thing:
pawn Код:
//==============================================================================
// GPS
//==============================================================================

CMD:gps(playerid,params[]) {

    if(PlayerInfo[playerid][Level] >= 3)
    return SendClientMessage(playerid,red,"ERROR: You need to be Level 3 to use this Command");

    if(PlayerInfo[playerid][SpecType] != ADMIN_SPEC_TYPE_NONE)
    return SendClientMessage(playerid, red, "ERROR: First Disable the Spectating System! (/lspecoff)");

    if(!strlen(params))
    return SendClientMessage(playerid,LIGHTBLUE2, "Usage: /gps [PlayerID/Off]") &&
    SendClientMessage(playerid, orange, "Function: Will enable GPS do find a specified Player (If you are in a race, do not use)");

    if(strcmp(params,"off",true) == 0)
    {
        GameTextForPlayer(playerid,"~w~Gps ~r~Off!",3000,3);
        IsDisable[playerid] = 0;
        PlayerInfo[playerid][pGps] = -1;
        return 1;
    }
    new player1;
    new string2[128];
    player1 = strval(params);
    if(player1 == playerid)
    return SendClientMessage(playerid,red,"ERROR: You can not Find yourself!");

    if(PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel])
    return SendClientMessage(playerid,red,"ERROR: You can not localize an Administrator!");

    if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
    {
        new playername[MAX_PLAYER_NAME];
        GetPlayerName(player1, playername, sizeof(playername));
        format(string2, sizeof(string2),"<LuxGps> System Enabled in the Player - '%s'", playername);
        SendClientMessage(playerid, 0xDC686BAA, string2);
        GameTextForPlayer(playerid,"~w~Gps ~g~On!",3000,3);
        PlayerInfo[playerid][pGps] = player1;
        }
    else return SendClientMessage(playerid,red,"ERROR: Player is not connected");
    return 1;
    }

//==============================================================================
// Gps
//==============================================================================
public LuxGpsSys(playerid)
for(new g = 0;g < MAX_PLAYERS; g++)
if(IsPlayerConnected(g))
{
    if(PlayerInfo[g][pGps] != -1)
    {
        if(IsPlayerConnected(PlayerInfo[g][pGps]))
        {
            new Float:X,
                Float:Y,
                Float:Z;

            new Float:X2,
                Float:Y2,
                Float:Z2;

            new Distance,
                LuX_GpsCity[MAX_ZONE_NAME] = "Undetected City!",
                LuX_GpsZone[MAX_ZONE_NAME] = "Undetected Zone!";

            GetPlayerInCity(PlayerInfo[g][pGps], LuX_GpsCity, MAX_ZONE_NAME);
            GetPlayerInZone(PlayerInfo[g][pGps], LuX_GpsZone, MAX_ZONE_NAME);
            GetPlayerPos(g, X, Y, Z);
            GetPlayerPos(PlayerInfo[g][pGps], X2, Y2, Z2);

            Distance = floatround(floatsqroot(floatadd(floatadd(floatpower(floatabs(floatsub(X,X2)),2),floatpower(floatabs(floatsub(Y,Y2)),2)),floatpower(floatabs(floatsub(Z,Z2)),2))));
            if(Distance > 6.0)
            {
                new str[256];
                new pname[256];

                #if GpsCheckPoint == true
                SetPlayerRaceCheckpoint(g, 0, X2, Y2, Z2+2, X2, Y2, Z2-10, 5.0);
                #endif
                TextDrawShowForPlayer(g, GpsTD[g]);

                pname = pName(PlayerInfo[g][pGps]);
                pname = strreplace("[", "(", pname); pname = strreplace("[", "(", pname);
                pname = strreplace("]", ")", pname); pname = strreplace("]", ")", pname);

                #if GpsOnlyCity == true
                format(str, 256, "~w~- %s -~n~~n~~b~Distance: ~w~%d ~l~- ~b~Radar: ~w~%s", pname,Distance, LuX_GpsCity);
                TextDrawSetString(GpsTD[g], str);
                #else
                format(str, 256, "~w~- %s -~n~~n~~b~Distance: ~w~%d ~l~- ~b~Radar: ~w~%s (%s)", pname,Distance, LuX_GpsZone, LuX_GpsCity);
                TextDrawSetString(GpsTD[g], str);
                #endif
            }
            else
            {
                #if GpsCheckPoint == true
                DisablePlayerRaceCheckpoint(g);
                #endif
            }
        }
        else
        {
        PlayerInfo[g][pGps] = -1;
        GameTextForPlayer(g,"~r~Gps Off~n~~g~The Player you used GPS on has left the Server!",3000,3);
        }
    }
    else
    {
        TextDrawHideForPlayer(g, GpsTD[g]);
        if(IsDisable[g] == 0)
        #if GpsCheckPoint == true
        DisablePlayerRaceCheckpoint(g);
        #endif
        IsDisable[g] = 1;
    }
}
New Errors:

pawn Код:
C:\Users\Ole Kristian\Desktop\San Andreas Server\gamemodes\SATDM~RP.pwn(14794) : warning 219: local variable "Distance" shadows a variable at a preceding level
C:\Users\Ole Kristian\Desktop\San Andreas Server\gamemodes\SATDM~RP.pwn(14798) : error 017: undefined symbol "GetPlayerInCity"
C:\Users\Ole Kristian\Desktop\San Andreas Server\gamemodes\SATDM~RP.pwn(14799) : error 017: undefined symbol "GetPlayerInZone"
C:\Users\Ole Kristian\Desktop\San Andreas Server\gamemodes\SATDM~RP.pwn(14809) : error 017: undefined symbol "GpsCheckPoint"
C:\Users\Ole Kristian\Desktop\San Andreas Server\gamemodes\SATDM~RP.pwn(14818) : error 017: undefined symbol "GpsOnlyCity"
C:\Users\Ole Kristian\Desktop\San Andreas Server\gamemodes\SATDM~RP.pwn(14828) : error 017: undefined symbol "GpsCheckPoint"
C:\Users\Ole Kristian\Desktop\San Andreas Server\gamemodes\SATDM~RP.pwn(14843) : error 017: undefined symbol "GpsCheckPoint"
C:\Users\Ole Kristian\Desktop\San Andreas Server\gamemodes\SATDM~RP.pwn(16485) : error 010: invalid function or declaration
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


7 Errors.
Reply
#7

you have to start a comand with { and finish with }
Reply
#8

Quote:
Originally Posted by axxelac
Посмотреть сообщение
you have to start a comand with { and finish with }
pawn Код:
CMD:gps(playerid,params[]){
pawn Код:
else return SendClientMessage(playerid,red,"ERROR: Player is not connected");
    return 1;
    }
as you can see I already have that..
Reply
#9

comand (i,playerid,params[])
{
Reply
#10

Quote:
Originally Posted by axxelac
Посмотреть сообщение
comand (i,playerid,params[])
{
It doesnt matter if its beside the command or below.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)