must be a variable. Assumed 0. How to solve this?
#1

I am trying to build a command to attach the camera to your car. but i get this:

Код:
C:\Users\HeLiOn\Desktop\camtest.pwn(42) : error 008: must be a constant expression; assumed zero
C:\Users\HeLiOn\Desktop\camtest.pwn(42) : error 029: invalid expression, assumed zero
C:\Users\HeLiOn\Desktop\camtest.pwn(42) : error 029: invalid expression, assumed zero
C:\Users\HeLiOn\Desktop\camtest.pwn(42) : fatal error 107: too many error messages on one line
The code is below. I bolded the line 42. How can I solve this?

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/camtest", cmdtext, true, 10) == 0)
	{
	    new p = GetPlayerVehicleID(playerid);
	    new campos[playerid] = CreatePlayerObject(playerid,19300, 0., 0,0, 0.0000, -1, -1, 100);
            AttachPlayerObjectToVehicle(playerid,campos[playerid],p,0.0, 0.0, 5.510000, 0.000000, 0.000000, 0.000000);
	    AttachCameraToPlayerObject(playerid,campos[playerid]);
	}
	if (strcmp("/resetcam", cmdtext, true, 10) == 0)
	{
	    DestroyObject(object[playerid]);
	    return 1;
	}
	return 0;
}
Reply
#2

pawn Код:
new campos[playerid] = CreatePlayerObject(playerid,19300, 0.0, 0,0, 0.0000, -1, -1, 100);
Reply
#3

I still get the errors, but the 3rd now is:
Код:
C:\Users\HeLiOn\Desktop\camtest.pwn(42) : error 036: empty statement
Reply
#4

Your code doesn't make any sense. To access an index of an array, the array must have been created priorly. In your next command you also use object[playerid]. (?)
Reply
#5

ok I solved the error problem.

Now, is there a way to make the camera look at an object? I can make it look at some coords, but the player can be anywhere on the map, so I can't really use that. How can I controll the attached camera direction?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)