having trouble solving undefined errors
#1

As soon as I placed a script in from another game mode to do a dmv test before getting a license I started getting undefined errors for it, can anyone figure it out?
Quote:

C:\Users\Chris\Desktop\SAMP\pawno\include\YSI\y_ut ils.inc(160) : warning 219: local variable "str" shadows a variable at a preceding level
C:\Users\Chris\Desktop\SAMP\pawno\include\YSI\y_ut ils.inc(263) : warning 219: local variable "str" shadows a variable at a preceding level
C:\Users\Chris\Desktop\SAMP\pawno\include\YSI\y_ut ils.inc(289) : warning 219: local variable "str" shadows a variable at a preceding level
C:\Users\Chris\Desktop\SAMP\pawno\include\YSI\y_de bug.inc(231) : warning 219: local variable "str" shadows a variable at a preceding level
C:\Users\Chris\Desktop\SAMP\pawno\include\YSI\y_de bug.inc(291) : warning 219: local variable "str" shadows a variable at a preceding level
C:\Users\Chris\Desktop\SAMP\pawno\include\YSI\y_de bug.inc(296) : warning 219: local variable "str" shadows a variable at a preceding level
C:\Users\Chris\Desktop\SAMP\gamemodes\1.1.pwn(1515 ) : warning 204: symbol is assigned a value that is never used: "TakingLesson"
C:\Users\Chris\Desktop\SAMP\gamemodes\1.1.pwn(1514 ) : warning 204: symbol is assigned a value that is never used: "CP"
C:\Users\Chris\Desktop\SAMP\gamemodes\1.1.pwn(1513 ) : warning 203: symbol is never used: "dmvc2"
C:\Users\Chris\Desktop\SAMP\gamemodes\1.1.pwn(1512 ) : warning 203: symbol is never used: "dmvc1"
C:\Users\Chris\Desktop\SAMP\gamemodes\1.1.pwn(1511 ) : warning 203: symbol is never used: "dmvc"
C:\Users\Chris\Desktop\SAMP\gamemodes\1.1.pwn(1548 ) : error 017: undefined symbol "CP"
C:\Users\Chris\Desktop\SAMP\gamemodes\1.1.pwn(1548 ) : warning 215: expression has no effect
C:\Users\Chris\Desktop\SAMP\gamemodes\1.1.pwn(1548 ) : error 001: expected token: ";", but found "]"
C:\Users\Chris\Desktop\SAMP\gamemodes\1.1.pwn(1548 ) : error 029: invalid expression, assumed zero
C:\Users\Chris\Desktop\SAMP\gamemodes\1.1.pwn(1548 ) : 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 Код:
//========================================[DMV]=================================
    new dmvc;
    new dmvc1;
    new dmvc2;
    new CP[MAX_PLAYERS];
    new TakingLesson[MAX_PLAYERS];
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    //xObject
    for(new i = 0; i < sizeof(Objects); i++) ////Xobj
    {
        if(Player[playerid][view][i])
        {
            Player[playerid][view][i] = false;
            DestroyPlayerObject(playerid,Player[playerid][objid][i]);
        }
    }

    new string[200]; new pname[24]; GetPlayerName(playerid, pname, 24);
    PLAYERLIST_authed[playerid]=false;
    switch(reason)
    {
        case 0: format(string, 200, "%s(%d) has left the server. (Timeout)", pname, playerid);
        case 1: format(string, 200, "%s(%d) has left the server. (Left)", pname, playerid);
        case 2: format(string, 200, "%s(%d) has left the server. (Kicked)", pname, playerid);
    }
    SendClientMessageToAll(COLOR_DEADCONNECT, string);
    IRC_Say(gBotID[0], IRC_CHANNEL, string);
    playerCheckpoint[playerid] =0;
    RemoveVariables(playerid);
    return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
    if(CP[playerid]==200)//dmv_01

        if(IsPlayerInVehicle(playerid, dmvc) || IsPlayerInVehicle(playerid, dmvc1) || IsPlayerInVehicle(playerid, dmvc2))
        {
            DisablePlayerCheckpoint(playerid);
            CP[playerid] = 201;
            SetPlayerCheckpoint(playerid, 1432.4354,-1658.6343,13.1245, 5.0);
        }
        else
        {
            SendClientMessage(playerid, COLOR_LIGHTBLUE,"DMV: You are not in the car!");
            SendClientMessage(playerid, COLOR_LIGHTBLUE,"DMV: You didn't passed the test, please try again!");
            DisablePlayerCheckpoint(playerid);
            RemovePlayerFromVehicle(playerid);
            SetVehicleToRespawn(GetPlayerVehicleID(playerid));
            TakingLesson[playerid] = 0;
        }
     }
    else if(CP[playerid]==201)//dmv_02
    {
        DisablePlayerCheckpoint(playerid);
        CP[playerid] = 202;
        SetPlayerCheckpoint(playerid, 1432.3827,-1588.9227,13.1318, 5.0);
    }
    else if(CP[playerid]==202)//dmv_03
    {
        DisablePlayerCheckpoint(playerid);
        CP[playerid] = 203;
        SetPlayerCheckpoint(playerid, 1454.7500,-1480.2014,13.0978, 5.0);
    }
    else if(CP[playerid]==203)//dmv_04
    {
        DisablePlayerCheckpoint(playerid);
        CP[playerid] = 204;
        SetPlayerCheckpoint(playerid, 1457.2000,-1439.2382,13.1303, 5.0);
    }
    else if(CP[playerid]==204)//dmv_05
    {
        DisablePlayerCheckpoint(playerid);
        CP[playerid] = 205;
        SetPlayerCheckpoint(playerid, 1429.9436,-1437.6150,13.1244, 5.0);
    }
    else if(CP[playerid]==205)//dmv_06
    {
        DisablePlayerCheckpoint(playerid);
        CP[playerid] = 206;
        SetPlayerCheckpoint(playerid, 1423.7155,-1398.9248,13.1238, 5.0);
    }
    else if(CP[playerid]==206)//dmv_07
    {
        DisablePlayerCheckpoint(playerid);
        CP[playerid] = 207;
        SetPlayerCheckpoint(playerid, 1350.0922,-1393.0492,13.1469, 5.0);
    }
    else if(CP[playerid]==207)//dmv_08
    {
        DisablePlayerCheckpoint(playerid);
        CP[playerid] = 208;
        SetPlayerCheckpoint(playerid, 1106.5748,-1397.0431,13.1716, 5.0);
    }
    else if(CP[playerid]==208)//dmv_09
    {
        DisablePlayerCheckpoint(playerid);
        CP[playerid] = 209;
        SetPlayerCheckpoint(playerid, 1059.6833,-1419.8898,13.1155, 5.0);
    }
    else if(CP[playerid]==209)//dmv_10
    {
        DisablePlayerCheckpoint(playerid);
        CP[playerid] = 210;
        SetPlayerCheckpoint(playerid, 1035.0563,-1571.5737,13.1341, 5.0);
    }
    else if(CP[playerid]==210)//dmv_11
    {
        DisablePlayerCheckpoint(playerid);
        CP[playerid] = 211;
        SetPlayerCheckpoint(playerid, 1143.5441,-1574.9717,13.0121, 5.0);
    }
    else if(CP[playerid]==211)//dmv_12
    {
        DisablePlayerCheckpoint(playerid);
        CP[playerid] = 212;
        SetPlayerCheckpoint(playerid, 1289.9336,-1574.8125,13.1246, 5.0);
    }
    else if(CP[playerid]==212)//dmv_13
    {
        DisablePlayerCheckpoint(playerid);
        CP[playerid] = 213;
        SetPlayerCheckpoint(playerid, 1295.0909,-1659.1091,13.1246, 5.0);
    }
    else if(CP[playerid]==213)//dmv_14
    {
        DisablePlayerCheckpoint(playerid);
        CP[playerid] = 214;
        SetPlayerCheckpoint(playerid, 1295.0031,-1704.4797,13.1240, 5.0);
    }
    else if(CP[playerid]==214)//dmv_15
    {
        DisablePlayerCheckpoint(playerid);
        CP[playerid] = 215;
        SetPlayerCheckpoint(playerid, 1299.5117,-1817.1479,13.1245, 5.0);
    }
    else if(CP[playerid]==215)//dmv_16
    {
        DisablePlayerCheckpoint(playerid);
        CP[playerid] = 216;
        SetPlayerCheckpoint(playerid, 1300.8134,-1855.0059,13.1245, 5.0);
    }
    else if(CP[playerid]==216)//dmv_17
    {
        DisablePlayerCheckpoint(playerid);
        CP[playerid] = 217;
        SetPlayerCheckpoint(playerid, 1389.0083,-1874.1768,13.1245, 5.0);
    }
    else if(CP[playerid]==217)//dmv_18
    {
        DisablePlayerCheckpoint(playerid);
        CP[playerid] = 218;
        SetPlayerCheckpoint(playerid, 1523.0303,-1874.8875,13.1266, 5.0);
    }
    else if(CP[playerid]==218)//dmv_19
    {
        DisablePlayerCheckpoint(playerid);
        CP[playerid] = 219;
        SetPlayerCheckpoint(playerid, 1571.1161,-1872.5188,13.1252, 5.0);
    }
    else if(CP[playerid]==219)//dmv_20
    {
        DisablePlayerCheckpoint(playerid);
        CP[playerid] = 220;
        SetPlayerCheckpoint(playerid, 1572.3271,-1733.9789,13.1269, 5.0);
    }
    else if(CP[playerid]==220)//dmv_21
    {
        DisablePlayerCheckpoint(playerid);
        CP[playerid] = 221;
        SetPlayerCheckpoint(playerid, 1531.4258,-1730.1346,13.1245, 5.0);
    }
    else if(CP[playerid]==221)//dmv_22
    {
        DisablePlayerCheckpoint(playerid);
        CP[playerid] = 222;
        SetPlayerCheckpoint(playerid, 1437.5671,-1730.2736,13.1254, 5.0);
    }
    else if(CP[playerid]==222)//dmv_23
    {
        DisablePlayerCheckpoint(playerid);
        CP[playerid] = 223;
        SetPlayerCheckpoint(playerid, 1424.2367,-1694.3533,13.2030, 5.0);
    }
    else if(CP[playerid]==223)//dmv_Final
    {
        new pName[24];
        new str[128];
        GetPlayerName(playerid, pName, 24);
        pName[strfind(pName,"_")] = ' ';
        GivePlayerCash(playerid, -500);
        format(str, 128,"DMV: Congratulations %s! You passed the test.", pName);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
        RemovePlayerFromVehicle(playerid);
        SetVehicleToRespawn(GetPlayerVehicleID(playerid));
        TakingLesson[playerid] = 0;
        PlayerInfo[playerid][pDriveLic] = 1;
        DisablePlayerCheckpoint(playerid);
    }
    else
    {
        DisablePlayerCheckpoint(playerid);
    }
    return 1;
Reply
#2

Remove these lines and try again.
pawn Код:
//========================================[DMV]=================================
    new dmvc;
    new dmvc1;
    new dmvc2;
    new CP[MAX_PLAYERS];
    new TakingLesson[MAX_PLAYERS];
    return 1;
}
Reply
#3

Quote:
Originally Posted by Ballu Miaa
Посмотреть сообщение
Remove these lines and try again.
pawn Код:
//========================================[DMV]=================================
    new dmvc;
    new dmvc1;
    new dmvc2;
    new CP[MAX_PLAYERS];
    new TakingLesson[MAX_PLAYERS];
    return 1;
}
Added more errors and warning, didnt help =[
Reply
#4

These are caused by a global string between your includes and GM. It would be advised to change your global 'str' to something different, you'll also need to change it where ever you used it, or alternatively just ignore them.
Код:
C:\Users\Chris\Desktop\SAMP\pawno\include\YSI\y_ut ils.inc(160) : warning 219: local variable "str" shadows a variable at a preceding level
C:\Users\Chris\Desktop\SAMP\pawno\include\YSI\y_ut ils.inc(263) : warning 219: local variable "str" shadows a variable at a preceding level
C:\Users\Chris\Desktop\SAMP\pawno\include\YSI\y_ut ils.inc(289) : warning 219: local variable "str" shadows a variable at a preceding level
C:\Users\Chris\Desktop\SAMP\pawno\include\YSI\y_de bug.inc(231) : warning 219: local variable "str" shadows a variable at a preceding level
C:\Users\Chris\Desktop\SAMP\pawno\include\YSI\y_de bug.inc(291) : warning 219: local variable "str" shadows a variable at a preceding level
C:\Users\Chris\Desktop\SAMP\pawno\include\YSI\y_de bug.inc(296) : warning 219: local variable "str" shadows a variable at a preceding level
Can you please add some line numbers so we can see what lines are what.
EG:
pawn Код:
(1515)//========================================[DMV]=================================
(1516)    new dmvc;
(1517)    new dmvc1;
(1518)    new dmvc2;
(1519)    new CP[MAX_PLAYERS];
(1520)    new TakingLesson[MAX_PLAYERS];
(1521)    return 1;
(1522)}
Reply
#5

pawn Код:
1545:public OnPlayerEnterCheckpoint(playerid)
1546:{
1547:if(CP[playerid]==200)//dmv_01
1548:
1549:   if(IsPlayerInVehicle(playerid, dmvc) || IsPlayerInVehicle(playerid, dmvc1) ||IsPlayerInVehicle(playerid,dmvc2))
1550:       {
1551:           DisablePlayerCheckpoint(playerid);
1552:           CP[playerid] = 201;
1553:           SetPlayerCheckpoint(playerid, 1432.4354,-1658.6343,13.1245, 5.0);
1554:       }
1556        else
1557        {
1558            SendClientMessage(playerid, COLOR_LIGHTBLUE,"DMV: You are not in the car!");
1559            SendClientMessage(playerid, COLOR_LIGHTBLUE,"DMV: You didn't passed the test, please try again!");
1560            DisablePlayerCheckpoint(playerid);
1561            RemovePlayerFromVehicle(playerid);
1562            SetVehicleToRespawn(GetPlayerVehicleID(playerid));
1563            TakingLesson[playerid] = 0;
1564        }
1565       }
1566      else if(CP[playerid]==201)//dmv_02
1567    {
1568        DisablePlayerCheckpoint(playerid);
1569        CP[playerid] = 202;
        SetPlayerCheckpoint(playerid, 1432.3827,-1588.9227,13.1318, 5.0);
    }
    else if(CP[playerid]==202)//dmv_03
    {
        DisablePlayerCheckpoint(playerid);
        CP[playerid] = 203;
        SetPlayerCheckpoint(playerid, 1454.7500,-1480.2014,13.0978, 5.0);
    }
    else if(CP[playerid]==203)//dmv_04
    {
        DisablePlayerCheckpoint(playerid);
        CP[playerid] = 204;
        SetPlayerCheckpoint(playerid, 1457.2000,-1439.2382,13.1303, 5.0);
    }
    else if(CP[playerid]==204)//dmv_05
    {
        DisablePlayerCheckpoint(playerid);
        CP[playerid] = 205;
        SetPlayerCheckpoint(playerid, 1429.9436,-1437.6150,13.1244, 5.0);
    }
    else if(CP[playerid]==205)//dmv_06
    {
        DisablePlayerCheckpoint(playerid);
        CP[playerid] = 206;
        SetPlayerCheckpoint(playerid, 1423.7155,-1398.9248,13.1238, 5.0);
    }
    else if(CP[playerid]==206)//dmv_07
    {
        DisablePlayerCheckpoint(playerid);
        CP[playerid] = 207;
        SetPlayerCheckpoint(playerid, 1350.0922,-1393.0492,13.1469, 5.0);
    }
    else if(CP[playerid]==207)//dmv_08
    {
        DisablePlayerCheckpoint(playerid);
        CP[playerid] = 208;
        SetPlayerCheckpoint(playerid, 1106.5748,-1397.0431,13.1716, 5.0);
    }
    else if(CP[playerid]==208)//dmv_09
    {
        DisablePlayerCheckpoint(playerid);
        CP[playerid] = 209;
        SetPlayerCheckpoint(playerid, 1059.6833,-1419.8898,13.1155, 5.0);
    }
    else if(CP[playerid]==209)//dmv_10
    {
        DisablePlayerCheckpoint(playerid);
        CP[playerid] = 210;
        SetPlayerCheckpoint(playerid, 1035.0563,-1571.5737,13.1341, 5.0);
    }
    else if(CP[playerid]==210)//dmv_11
    {
        DisablePlayerCheckpoint(playerid);
        CP[playerid] = 211;
        SetPlayerCheckpoint(playerid, 1143.5441,-1574.9717,13.0121, 5.0);
    }
    else if(CP[playerid]==211)//dmv_12
    {
        DisablePlayerCheckpoint(playerid);
        CP[playerid] = 212;
        SetPlayerCheckpoint(playerid, 1289.9336,-1574.8125,13.1246, 5.0);
    }
    else if(CP[playerid]==212)//dmv_13
    {
        DisablePlayerCheckpoint(playerid);
        CP[playerid] = 213;
        SetPlayerCheckpoint(playerid, 1295.0909,-1659.1091,13.1246, 5.0);
    }
    else if(CP[playerid]==213)//dmv_14
    {
        DisablePlayerCheckpoint(playerid);
        CP[playerid] = 214;
        SetPlayerCheckpoint(playerid, 1295.0031,-1704.4797,13.1240, 5.0);
    }
    else if(CP[playerid]==214)//dmv_15
    {
        DisablePlayerCheckpoint(playerid);
        CP[playerid] = 215;
        SetPlayerCheckpoint(playerid, 1299.5117,-1817.1479,13.1245, 5.0);
    }
    else if(CP[playerid]==215)//dmv_16
    {
        DisablePlayerCheckpoint(playerid);
        CP[playerid] = 216;
        SetPlayerCheckpoint(playerid, 1300.8134,-1855.0059,13.1245, 5.0);
    }
    else if(CP[playerid]==216)//dmv_17
    {
        DisablePlayerCheckpoint(playerid);
        CP[playerid] = 217;
        SetPlayerCheckpoint(playerid, 1389.0083,-1874.1768,13.1245, 5.0);
    }
    else if(CP[playerid]==217)//dmv_18
    {
        DisablePlayerCheckpoint(playerid);
        CP[playerid] = 218;
        SetPlayerCheckpoint(playerid, 1523.0303,-1874.8875,13.1266, 5.0);
    }
    else if(CP[playerid]==218)//dmv_19
    {
        DisablePlayerCheckpoint(playerid);
        CP[playerid] = 219;
        SetPlayerCheckpoint(playerid, 1571.1161,-1872.5188,13.1252, 5.0);
    }
    else if(CP[playerid]==219)//dmv_20
    {
        DisablePlayerCheckpoint(playerid);
        CP[playerid] = 220;
        SetPlayerCheckpoint(playerid, 1572.3271,-1733.9789,13.1269, 5.0);
    }
    else if(CP[playerid]==220)//dmv_21
    {
        DisablePlayerCheckpoint(playerid);
        CP[playerid] = 221;
        SetPlayerCheckpoint(playerid, 1531.4258,-1730.1346,13.1245, 5.0);
    }
    else if(CP[playerid]==221)//dmv_22
    {
        DisablePlayerCheckpoint(playerid);
        CP[playerid] = 222;
        SetPlayerCheckpoint(playerid, 1437.5671,-1730.2736,13.1254, 5.0);
    }
    else if(CP[playerid]==222)//dmv_23
    {
        DisablePlayerCheckpoint(playerid);
        CP[playerid] = 223;
        SetPlayerCheckpoint(playerid, 1424.2367,-1694.3533,13.2030, 5.0);
    }
    else if(CP[playerid]==223)//dmv_Final
    {
        new pName[24];
        new str[128];
        GetPlayerName(playerid, pName, 24);
        pName[strfind(pName,"_")] = ' ';
        GivePlayerCash(playerid, -500);
        format(str, 128,"DMV: Congratulations %s! You passed the test.", pName);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, str);
        RemovePlayerFromVehicle(playerid);
        SetVehicleToRespawn(GetPlayerVehicleID(playerid));
        TakingLesson[playerid] = 0;
        PlayerInfo[playerid][pDriveLic] = 1;
        DisablePlayerCheckpoint(playerid);
    }
    else
    {
        DisablePlayerCheckpoint(playerid);
    }
    return 1;
Quote:

C:\Users\Chris\Desktop\SAMP\pawno\include\YSI\y_de bug.inc(291) : warning 219: local variable "str" shadows a variable at a preceding level
C:\Users\Chris\Desktop\SAMP\pawno\include\YSI\y_de bug.inc(296) : warning 219: local variable "str" shadows a variable at a preceding level
C:\Users\Chris\Desktop\SAMP\gamemodes\1.1.pwn(1514 ) : warning 204: symbol is assigned a value that is never used: "TakingLesson"
C:\Users\Chris\Desktop\SAMP\gamemodes\1.1.pwn(1513 ) : warning 204: symbol is assigned a value that is never used: "CP"
C:\Users\Chris\Desktop\SAMP\gamemodes\1.1.pwn(1512 ) : warning 203: symbol is never used: "dmvc2"
C:\Users\Chris\Desktop\SAMP\gamemodes\1.1.pwn(1511 ) : warning 203: symbol is never used: "dmvc1"
C:\Users\Chris\Desktop\SAMP\gamemodes\1.1.pwn(1510 ) : warning 203: symbol is never used: "dmvc"
C:\Users\Chris\Desktop\SAMP\gamemodes\1.1.pwn(1547 ) : error 017: undefined symbol "CP"
C:\Users\Chris\Desktop\SAMP\gamemodes\1.1.pwn(1547 ) : warning 215: expression has no effect
C:\Users\Chris\Desktop\SAMP\gamemodes\1.1.pwn(1547 ) : error 001: expected token: ";", but found "]"
C:\Users\Chris\Desktop\SAMP\gamemodes\1.1.pwn(1547 ) : error 029: invalid expression, assumed zero
C:\Users\Chris\Desktop\SAMP\gamemodes\1.1.pwn(1547 ) : fatal error 107: too many error messages on one line

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


4 Errors.

Reply
#6

Show us where you define/create 'CP'.
It seems not to exist.

EDIT

It seems you have defined this variable in a function. You should edit it so it is a global variable.
Mostly people create those somewhere at the top of your gamemode.
Reply
#7

new CP;
Reply
#8

Quote:
Originally Posted by Avi57
Посмотреть сообщение
new CP;
No, new CP[MAX_PLAYERS];
And don't put it inside a function like you did in the script you posted.
Reply
#9

Quote:
Originally Posted by Roel
Посмотреть сообщение
No, new CP[MAX_PLAYERS];
And don't put it inside a function like you did in the script you posted.
Doesnt seem like it was defined in the GM I got it from, could you explain how I can fix it?
Reply
#10

Just put: new CP[MAX_PLAYERS];
Above public OnPlayerEnterCheckpoint(playerid)
that should maybe also work.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)