Erros em IsPlayerAimingAt -
minimessi10 - 08.05.2015
Ei, eu estava programando e fui usar a funзгo IsPlayerAimingAt. Porйm, ao inseri-la no GameMode deu os seguintes erros e eu nгo conseguir arruma-los.
pawn Код:
RPG\gamemodes\GTARPG.pwn(1089) : warning 208: function with tag result used before definition, forcing reparse
RPG\gamemodes\GTARPG.pwn(1089) : error 002: only a single statement (or expression) can follow each "case"
RPG\gamemodes\GTARPG.pwn(1089) : warning 221: label name "Float" shadows tag name
RPG\gamemodes\GTARPG.pwn(1089) : error 017: undefined symbol "angle"
RPG\gamemodes\GTARPG.pwn(1089) : warning 215: expression has no effect
RPG\gamemodes\GTARPG.pwn(1090) : error 017: undefined symbol "angle"
RPG\gamemodes\GTARPG.pwn(1091) : error 017: undefined symbol "angle"
RPG\gamemodes\GTARPG.pwn(1089) : warning 203: symbol is never used: "Float"
RPG\gamemodes\GTARPG.pwn(1089 -- 1095) : error 054: unmatched closing brace ("}")
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
5 Errors.
Linhas do erro
pawn Код:
new Float:angle = GetPointAngleToPoint(0, 0, floatsqroot(vector_x*vector_x+vector_y*vector_y), vector_z) - 270.0;
new Float:resize_x, Float:resize_y, Float:resize_z = floatsin(angle+vertical, degrees);
GetXYInFrontOfPoint(resize_x, resize_y, GetPointAngleToPoint(0, 0, vector_x, vector_y)+horizontal, floatcos(angle+vertical, degrees));
if(DistanceCameraTargetToLocation(camera_x, camera_y, camera_z, x, y, z, resize_x, resize_y, resize_z) < radius) return true;
return false;
}
}
Funзгo toda.
pawn Код:
stock IsPlayerAimingAt(playerid, Float:x, Float:y, Float:z, Float:radius)
{
new Float:camera_x,Float:camera_y,Float:camera_z,Float:vector_x,Float:vector_y,Float:vector_z;
GetPlayerCameraPos(playerid, camera_x, camera_y, camera_z);
GetPlayerCameraFrontVector(playerid, vector_x, vector_y, vector_z);
new Float:vertical, Float:horizontal;
switch(GetPlayerWeapon(playerid))
{
case 34,35,36:
{
if(DistanceCameraTargetToLocation(camera_x, camera_y, camera_z, x, y, z, vector_x, vector_y, vector_z) < radius) return true;
return false;
}
case 30,31:
{
vertical = 4.0; horizontal = -1.6;
}
case 33:
{
vertical = 2.7; horizontal = -1.0;
}
default:
{
vertical = 6.0;
horizontal = -2.2;
}
new Float:angle = GetPointAngleToPoint(0, 0, floatsqroot(vector_x*vector_x+vector_y*vector_y), vector_z) - 270.0;
new Float:resize_x, Float:resize_y, Float:resize_z = floatsin(angle+vertical, degrees);
GetXYInFrontOfPoint(resize_x, resize_y, GetPointAngleToPoint(0, 0, vector_x, vector_y)+horizontal, floatcos(angle+vertical, degrees));
if(DistanceCameraTargetToLocation(camera_x, camera_y, camera_z, x, y, z, resize_x, resize_y, resize_z) < radius) return true;
return false;
}
}
Re: Erros em IsPlayerAimingAt -
n0minal - 08.05.2015
Nгo pode colocar coisas dentro dos switchs a nгo ser cases... A parte final ali deveria ser embaixo do penъltimo closing bracket ("}").
Ficaria assim:
Код:
stock IsPlayerAimingAt(playerid, Float:x, Float:y, Float:z, Float:radius)
{
new Float:camera_x,Float:camera_y,Float:camera_z,Float:vector_x,Float:vector_y,Float:vector_z;
GetPlayerCameraPos(playerid, camera_x, camera_y, camera_z);
GetPlayerCameraFrontVector(playerid, vector_x, vector_y, vector_z);
new Float:vertical, Float:horizontal;
switch(GetPlayerWeapon(playerid))
{
case 34,35,36:
{
if(DistanceCameraTargetToLocation(camera_x, camera_y, camera_z, x, y, z, vector_x, vector_y, vector_z) < radius) return true;
return false;
}
case 30,31:
{
vertical = 4.0; horizontal = -1.6;
}
case 33:
{
vertical = 2.7; horizontal = -1.0;
}
default:
{
vertical = 6.0;
horizontal = -2.2;
}
}
new Float:angle = GetPointAngleToPoint(0, 0, floatsqroot(vector_x*vector_x+vector_y*vector_y), vector_z) - 270.0;
new Float:resize_x, Float:resize_y, Float:resize_z = floatsin(angle+vertical, degrees);
GetXYInFrontOfPoint(resize_x, resize_y, GetPointAngleToPoint(0, 0, vector_x, vector_y)+horizontal, floatcos(angle+vertical, degrees));
if(DistanceCameraTargetToLocation(camera_x, camera_y, camera_z, x, y, z, resize_x, resize_y, resize_z) < radius) return true;
return false;
}
Por sinal й uma уtima funзгo, nгo esqueзa de agradecer o niCe e ao Jernej