26.07.2013, 04:23
Basically I tried to make a command which creates a camera and saves it into a file in scriptfiles/Cameras/cameraid.ini, but as always I massively failed while combining tons of information i found on sa-mp forums ^^
And here are the errors.
Код:
#define CAMERA_PATH "/Cameras/%d.ini"
#define MAX_CAMERAS 100
enum cInfo
{
cax,
cay,
caz,
limit,
cangle
}
new CameraInfo[MAX_CAMERAS][cInfo];
stock CameraPath()
{
new string[128],cameraid = CameraCount; //line 1438
format(string,sizeof(string),CAMERA_PATH, cameraid);
return string;
}
CMD:createcamera(playerid,params[])
{
if(PlayerInfo[playerid][pLevel] < 3) return error
if (sscanf(params,"n",limit)) return SendClientMessage(playerid, COLOR_RED,"USAGE: /createcamera <speedlimit>");
new Float:x,Float:y,Float:z,Float:cangle;
GetPlayerPos(playerid,x,y,z); //line 1447
z = z - 1.0;
GetPlayerFacingAngle(playerid,cangle);
new INI:File = INI_Open(CameraPath()); //line 1450
INI_SetTag(File, "Main");
INI_WriteInt(File, "Limit", limit);
INI_WriteFloat(File, "X", x);
INI_WriteFloat(File, "Y", y);
INI_WriteFloat(File, "Z", z);
INI_WriteFloat(File, "Angle", cangle);
INI_Close(File);
Camera[cameraid] = CreateDynamicObject(18880, x, y, z, 0.0, 0.0, cangle); //line 1458
SendClientMessage(playerid, COLOR_LIMEGREEN,"Speedcamera created!");
return 1;
}
Код:
C:\Users\Dorian\Desktop\sa-mp\gamemodes\bhaulers.pwn(1438) : error 017: undefined symbol "CameraCount" C:\Users\Dorian\Desktop\sa-mp\gamemodes\bhaulers.pwn(1458) : error 017: undefined symbol "Camera" C:\Users\Dorian\Desktop\sa-mp\gamemodes\bhaulers.pwn(1458) : error 017: undefined symbol "cameraid" C:\Users\Dorian\Desktop\sa-mp\gamemodes\bhaulers.pwn(1458) : error 029: invalid expression, assumed zero C:\Users\Dorian\Desktop\sa-mp\gamemodes\bhaulers.pwn(1458) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 5 Errors.


