error 028: invalid subscript (not an array or too many subscripts)
#1

I have an error when i compile the script: error 028: invalid subscript (not an array or too many subscripts): "drugdj"

The line is this:
Code:
if(drugdj[playerid] == 1) return SendClientMessage(playerid,COLOR_WHITE,"{999999}Wait until you can share the pizza again.");
and the command is this:
Code:
CMD:work(playerid, params[])
{
	new rand = random(sizeof(CursaRandomDrug));
    if(IsPlayerInRangeOfPoint(playerid,7.0,-2546.0862,9.2330,16.4219))
   	{
		if(PlayerInfo[playerid][pJob] >= 1)
	    {
			if(drugdj[playerid] == 1) return SendClientMessage(playerid,COLOR_WHITE,"{999999}Asteapta pana cand face o alta cursa.");
			{
				new Float:x, Float:y, Float:z, Float:a;
				GetPlayerPos(playerid, x,y,z); 
				GetPlayerFacingAngle(playerid, a);
				new vehicleid = CreateVehicle(459, x+3,y,z, a, -1, -1, -1);
				SetPlayerCheckpoint(playerid, CursaRandomDrug[rand][0], CursaRandomDrug[rand][1], CursaRandomDrug[rand][2], CursaRandomDrug[rand][3]);
				PutPlayerInVehicle(playerid, vehicleid, 0);
				SendClientMessage(playerid, COLOR_LIGHTBLUE, "JOB: Livreaza drogurile la destinatia setata pe harta!");
				drugdj[playerid] = 1;
				CP[playerid] = 0;
			}	
		}
	}
	return 1;
}
Reply
#2

Whats Cmd to do? Explain what it should do Please.
Reply
#3

The error message clearly states that "drugdj" is not an array. So make it an array.
Reply
#4

Quote:
Originally Posted by Vince
View Post
The error message clearly states that "drugdj" is not an array. So make it an array.
He dont know how are he would of do it wouldnt he?
Reply
#5

I did the same thing in a script and got no errors
Quote:

new drugdj[MAX_PLAYERS];

Is your answer
Reply
#6

Quote:
Originally Posted by Joron
View Post
He dont know how are he would of do it wouldnt he?
An array is a basic element of most, if not all, high level programming languages. Understanding the terminology is part one in understanding the language as a whole.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)