Stupid Error :/ - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Stupid Error :/ (
/showthread.php?tid=183415)
Stupid Error :/ -
Luis- - 15.10.2010
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if (GetPlayerVehicleID(playerid) == RentCars)
{
GameTextForPlayer(playerid, "This Vehicle is For Rent, Type /rentcar to rent it", 3000, 4);
}
return 1;
}
That code gives me this error
Код:
C:\Users\BooNii3\Foxx RP\Foxx RP\Core\gamemodes\Core1.pwn(275) : error 033: array must be indexed (variable "RentCars")
Re: Stupid Error :/ -
kurta999 - 15.10.2010
How much RentCar value ?
OnPlayerEnterVehicle called, if you pressed Enter/F.
Re: Stupid Error :/ -
Calgon - 15.10.2010
Can you post the part of the code where you define 'RentCars', please?
Re: Stupid Error :/ -
Luis- - 15.10.2010
pawn Код:
new Float:RentCars[][] =
{
{-103.8677,1222.1835,19.7359,180.4294}
};
Here you go
Re: Stupid Error :/ -
MadeMan - 15.10.2010
You need to save your vehicleid's to variables.
Re: Stupid Error :/ -
Calgon - 15.10.2010
As I thought, RentCars is an array, you can't just compare it like that, plus I see nothing in your code where the actual vehicle ID is defined. Your code makes no absolutely sense. And I just want to add, this isn't a "stupid error", it's called proper scripting.
Quote:
Originally Posted by MadeMan
pawn Код:
IsRentCar(vehicleid) { for(new i=0; i < sizeof(RentCars); i++) { if(RentCars[i] == vehicleid) { return 1; } } return 0; }
Use this function and it should work.
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) { if (IsRentCar(vehicleid)) { GameTextForPlayer(playerid, "This Vehicle is For Rent, Type /rentcar to rent it", 3000, 4); } return 1; }
|
Did you bother looking at his 2d array?
Re: Stupid Error :/ -
Luis- - 15.10.2010
I gave that a go but I got the same error
Код:
error 033: array must be indexed (variable "RentCars")
Sorry Calgon I am just learning, I am trying my best to make this..