Few errors.
#1

Yo, i got two errors.
pawn Код:
C:\Archivos de programa\Rockstar Games\GTA San Andreas\SA-MP 0.3c\Marricio Scripting\filterscripts\plate.pwn(111) : error 033: array must be indexed (variable "GetVehicleNumberPlate")
C:\Archivos de programa\Rockstar Games\GTA San Andreas\SA-MP 0.3c\Marricio Scripting\filterscripts\plate.pwn(133) : error 079: inconsistent return types (array & non-array)
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.
Code:
pawn Код:
stock GetVehicleNumberPlate(vehicleid) // By Jochemd
{
    if(vehicleid != INVALID_VEHICLE_ID) return vPlate[vehicleid];
    return 0; // error 2 here
}
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == D_TRACK)
    {
         for(new v; v<MAX_VEHICLES; v++)
         {
            if(GetVehicleNumberPlate(v) == strlen(inputtext)) // Error 1 here.
            {
                return 1;
            }
        }
    }
    return 1;
}
Reply
#2

You're comparing a string with the length of the inputtext variable, I'm not sure what you're trying to achieve there. Are you trying to compare the inputtext with number plate? If so you cannot compare strings directly in Pawn, you need to use strcmp, for example:

pawn Код:
if(strcmp(GetVehicleNumberPlate(v), inputtext, true) == 0) // They are the same
Also the second error means that you're using inconsistent return types, it means that at one point you are returning a string, and then you are returning an integer, you cannot do that, although I don't know why you even need that function, just do this:

pawn Код:
if(strcmp(vPlate[vehicleid], inputtext, true) == 0) // They are the same
It makes a lot more sense!
Reply
#3

Quote:
Originally Posted by JaTochNietDan
Посмотреть сообщение
You're comparing a string with the length of the inputtext variable, I'm not sure what you're trying to achieve there. Are you trying to compare the inputtext with number plate? If so you cannot compare strings directly in Pawn, you need to use strcmp, for example:

pawn Код:
if(strcmp(GetVehicleNumberPlate(v), inputtext, true) == 0) // They are the same
Also the second error means that you're using inconsistent return types, it means that at one point you are returning a string, and then you are returning an integer, you cannot do that, although I don't know why you even need that function, just do this:

pawn Код:
if(strcmp(vPlate[vehicleid], inputtext, true) == 0) // They are the same
It makes a lot more sense!
Oh well.. I understand now. Thank you! You're the best!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)