Error Bros - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Error Bros (
/showthread.php?tid=644200)
Error Bros -
PowerMwK - 04.11.2017
C:\Users\yPower\Desktop\gamemode\GM 0.3.8\gamemodes\GM.pwn(77995) : error 008: must be a constant expression; assumed zero
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.
pawn Код:
const VEHICLE_SYNC = 200;
IPacket:VEHICLE_SYNC(playerid, BitStream:bs)
{
    new inCarData[PR_InCarSync];
    BS_IgnoreBits(bs, 8);
    BS_ReadInCarSync(bs, inCarData);
    static Float:S = floatsqroot(floatpower(floatabs(inCarData[PR_velocity][0]), 2.0) + floatpower(floatabs(inCarData[PR_velocity][1]), 2.0) + floatpower(floatabs(inCarData[PR_velocity][2]), 2.0)) * 253.3;
    if(S > 350.0)
    {
      new string[144],name[MAX_PLAYER_NAME];
      GetPlayerName(playerid, name, sizeof(name));
      format(string,sizeof(string),"{FF0000}[Anti-SpeedCar]: {FFFF00}%s {999999}(ID:%d) {00FF00}auto-kicked {FF0000}[Reason: SpeedCar]", name,playerid);
      SendClientMessageToAll(COR_CAR, string);
      string[0] = EOS;
      Kick(playerid);
      return false;
    }
    return true;
}
Line
pawn Код:
static Float:S = floatsqroot(floatpower(floatabs(inCarData[PR_velocity][0]), 2.0) +
floatpower(floatabs(inCarData[PR_velocity][1]), 2.0) + floatpower(floatabs(inCarData[PR_velocity][2]), 2.0)) * 253.3;
Re: Error Bros -
Konstantinos - 05.11.2017
Cannot assign directly with
static so just:
pawn Код:
static Float:S;
S = floatsqroot(...) * 253.3;