Fatal Errors, Mystery to All [HELP]
#1

Код:
NewEnter(playerid, Float:x, Float:y, Float:z, universeID, Float:newX, Float:newY, Float:newZ){
	idCounter = 0;
	while(EnterSigns[idCounter][UNIVERSEID] != 9999 && idCounter != MAXENTERS){
		idCounter++;
	}
	if(idCounter == MAXENTERS && playerid != -1){
		SendClientMessage(playerid,COLOR_WHITE,"Maximum number of enter locations hit!");
	}
	else{
	  new aString[128];
   	EnterSigns[idCounter][PICKUPID] = CreatePickup(1239,23,x,y,z);
    EnterSigns[idCounter][ENTERX] = x;
    EnterSigns[idCounter][ENTERY] = y;
	  EnterSigns[idCounter][ENTERZ] = z;
	  EnterSigns[idCounter][UNIVERSEID] = universeID;
	  EnterSigns[idCounter][INTX] = newX;
	  EnterSigns[idCounter][INTY] = newY;
	  EnterSigns[idCounter][INTZ] = newZ;
	  if(playerid != -1){
		format(aString,sizeof(aString),"Enter point from %f, %f, %f to Universe %i: %f, %f, %f with ID %i.",EnterSigns[idCounter][ENTERX],EnterSigns[idCounter][ENTERY],EnterSigns[idCounter][ENTERZ],EnterSigns[idCounter][UNIVERSEID],EnterSigns[idCounter][INTX],EnterSigns[idCounter][INTY],EnterSigns[idCounter][INTZ],idCounter);
		SendClientMessage(playerid,COLOR_WHITE,aString);
		}
	}
	idCounter = 0;
}
Works 100% correctly. It gives me the right entrance in the right place to the right area, and combined with my enter/exit scripts, lets me enter and exit buildings however I like. That's not the problem. The problem, compadrйs, is this:

Код:
NewVehicle(playerid, modelid, Float:x, Float:y, Float:z, Float:angle, color1, color2){
	idCounter = 0;
	while(Vehicles[idCounter][MODELID] != 9999 && idCounter != MAXVEHICLES){
		idCounter++;
	}
	if(idCounter == MAXVEHICLES && playerid != -1){
		SendClientMessage(playerid,COLOR_WHITE,"Maximum number of vehicles hit!");
	}
	else{
	  new aString[128];
   	Vehicles[idCounter][VEHICLEID] = CreateVehicle(modelid, x, y, z, angle, color1, color2, 1200);
    Vehicles[idCounter][X] = x;
    Vehicles[idCounter][Y] = y;
	  Vehicles[idCounter][Z] = z;
	  Vehicles[idCounter][ANGLE] = angle;
	  Vehicles[idCounter][COLOR1] = color1;
	  Vehicles[idCounter][COLOR2] = color2;
	  if(playerid != -1){
		format(aString,sizeof(aString),"ID: %i, SLOT: %i",Vehicles[idCounter][VEHICLEID],idCounter);
		SendClientMessage(playerid,COLOR_WHITE,aString);
		}
	}
}
It has exactly the same form as the other script and compiles perfectly. All arrays etc. pertinent are initialised correctly. But when I call it from my command '/spawnveh', which is correct in all ways, I get an INVALID COMMAND error from the server. The problem can be traced to this section in the while loop declaration, which should be fine:

Код:
Vehicles[idCounter][MODELID] != 9999
And this is but the start of my woes. Ideally, all these functions would be declared as publics, with fowards. But when I use this code:

Код:
foward Blah();

public Blah(){
}
I get these errors from the compiler, for no reason. My friend compiles the same code perfectly.

Код:
error 010: invalid function or declaration
warning 235: public function lacks forward declaration (symbol "Blah")
HELP ME, OR I MAY DO SOMETHING HORRIFIC!
Reply
#2

forward, not foward
Post ur error command, maybe you forget a "return 1;" in ur command code.
Reply
#3

Код:
	if (!strcmp("/spawnveh", cmd, true)){
		if(!strlen(var1) || !strlen(var2) || !strlen(var3)){
			 SendClientMessage(playerid,COLOR_WHITE,"USAGE: /spawnveh [id][color1][color2]");
		}
		else{
			 if(strval(var1) > 399 && strval(var1) < 612){
	 			NewVehicle(playerid,strval(var1),playerX,playerY,playerZ,playerAng,strval(var2),strval(var3));
			 }
			 else{
       SendClientMessage(playerid,COLOR_WHITE,"Only IDs between 400 and 611 are valid.");
			 }
		}
		return 1;
	}
There we go. And the initialisation:

Код:
public OnGameModeInit()
{
	SetGameModeText("Alpha Testing");
  ClassInit();
	DisableInteriorEnterExits();
	AllowInteriorWeapons(1);
	//----------
	idCounter = 0;
	while(idCounter != MAXENTERS){
    EnterSigns[idCounter][UNIVERSEID] = 9999;
		idCounter++;
	}
	idCounter = 0;
	while(idCounter != MAXVEHICLES){
    Vehicles[idCounter][VEHICLEID] = 9999;
		idCounter++;
	}
	//----------
	AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
	return 1;
}
Thanks for the foward/forward. I hate it when spellings or typos screw up code. :P
Reply
#4

If it compiles at your friend correctly re download pawno.
Reply
#5

Quote:
Originally Posted by .:NoZer0:.
If it compiles at your friend correctly re download pawno.
Nah, what I just posted compiles fine but gives an INVALID COMMAND error when used.
Reply
#6

Try this.
pawn Код:
if (!strcmp("/spawnveh", cmd, true)){
if(!strlen(var1) || !strlen(var2) | | !strlen(var3)){
SendClientMessage (playerid,COLOR_WHITE,"USAGE: /spawnveh [id][color1] [color2]");
} else if(strval(var1) > 399 && strval(var1) < 612){
print "start"
NewVehicle(playerid,strval (var1),playerX,playerY,playerZ,playerAng,strval (var2),strval(var3));
print "end"
} else{
SendClientMessage(playerid,COLOR_WHITE,"Only IDs between 400 and 611 are valid.");
}
 return 1;
}
If it doesnt output "end", Theres something wrong on NewVehicle(...)
Reply
#7

That wouldn't compile, let alone work. It's print(""); not print ""

And as I said, the problem is found in this seemingly-harmless line:

Код:
Vehicles[idCounter][MODELID] != 9999
Reply
#8

Quote:
Originally Posted by Delphinus
That wouldn't compile, let alone work. It's print(""); not print ""

And as I said, the problem is found in this seemingly-harmless line:

Код:
Vehicles[idCounter][MODELID] != 9999
How could you find that is the problem?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)