SA-MP Forums Archive
Line 5 errors - 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: Line 5 errors (/showthread.php?tid=649314)



Line 5 errors - enzulikeS - 06.02.2018

D:\server\gamemodes\ExtremeGame.pwn(1609 : error 012: invalid function call, not a valid address
D:\server\gamemodes\ExtremeGame.pwn(1609 : error 029: invalid expression, assumed zero
D:\server\gamemodes\ExtremeGame.pwn(1609 : warning 215: expression has no effect
D:\server\gamemodes\ExtremeGame.pwn(1609 : error 001: expected token: ";", but found ")"
D:\server\gamemodes\ExtremeGame.pwn(1609 : fatal error 107: too many error messages on one line


if(GetPlayerState(i) == PLAYER_STATE_DRIVER && !IsAPlane(GetPlayerVehicleID(i))) {
new speed = Carspeed(i);
if(speed > 230 && PlayerInfo[i][pAdmin] < 1 && !IsPlayerInArea(i, -3000, -2274.5, -1776, -859.5))
{
if(GetVehicleModel(i) == 522 && speed < 250) return 1;
if(GetAdmins() > 0) {
format(string, sizeof(string), "AdmWarning: %s(%d) conduce cu %.0d km/h un %s.", GetName(i),i,speed,aVehicleNames[GetVehicleModel(GetPlayerVehicleID(i))-400]);
if(GetPVarInt(i, "Cover") == 0) SendAdminMessage(COLOR_WARNING, string,1);
}
else if(ServerSystem[5] == 0) NightBot(i, "Cheats (speed-hack)");
}
}

The errored line: if(GetAdmins() > 0) {


Re: Line 5 errors - dani18 - 06.02.2018

code of "GetAdmins()", show it


Re: Line 5 errors - enzulikeS - 06.02.2018

stock of it:

new GetAdmins;


Re: Line 5 errors - Hypex - 06.02.2018

Try doing this
Код:
if(GetPlayerState(i) == PLAYER_STATE_DRIVER && !IsAPlane(GetPlayerVehicleID(i))) 
{
    new speed = Carspeed(i);
    if(speed > 230 && PlayerInfo[i][pAdmin] < 1 && !IsPlayerInArea(i, -3000, -2274.5, -1776, -859.5))
    {
        if(GetVehicleModel(i) == 522 && speed < 250)
        {
            if(GetAdmins() > 0) 
           {
               format(string, sizeof(string), "AdmWarning: %s(%d) conduce cu %.0d km/h un %s.", 
               GetName(i),i,speed,aVehicleNames[GetVehicleModel(GetPlayerVehicleID(i))-400]);
               if(GetPVarInt(i, "Cover") == 0) SendAdminMessage(COLOR_WARNING, string,1);
           }
           else
           {
                if(ServerSystem[5] == 0) NightBot(i, "Cheats (speed-hack)");
           }
        }
    }
    return 1;
}
I just need to know if it works if not we'll try something else


Re: Line 5 errors - enzulikeS - 07.02.2018

D:\server\gamemodes\ExtremeGame.pwn(16099) : error 012: invalid function call, not a valid address
D:\server\gamemodes\ExtremeGame.pwn(16099) : error 029: invalid expression, assumed zero
D:\server\gamemodes\ExtremeGame.pwn(16099) : warning 215: expression has no effect
D:\server\gamemodes\ExtremeGame.pwn(16099) : error 001: expected token: ";", but found ")"
D:\server\gamemodes\ExtremeGame.pwn(16099) : fatal error 107: too many error messages on one line
same errors one the same line.


Re: Line 5 errors - solstice_ - 07.02.2018

GetAdmins()

Post the code of this function


Re: Line 5 errors - enzulikeS - 07.02.2018

Quote:
Originally Posted by enzulikeS
Посмотреть сообщение
stock of it:

new GetAdmins;
i only have this


Re: Line 5 errors - solstice_ - 07.02.2018

Quote:
Originally Posted by enzulikeS
Посмотреть сообщение
i only have this
I can't really understand what you're trying to do with that, is that code only for players who have administrator powers?


Re: Line 5 errors - enzulikeS - 07.02.2018

i created a function and removed the new; the errors are as follow:

Код:
D:\server\gamemodes\ExtremeGame.pwn(4740) : warning 219: local variable "using_deprecated_foreach_syntax" shadows a variable at a preceding level
D:\server\gamemodes\ExtremeGame.pwn(16112) : error 012: invalid function call, not a valid address
D:\server\gamemodes\ExtremeGame.pwn(16112) : warning 215: expression has no effect
D:\server\gamemodes\ExtremeGame.pwn(16112) : warning 215: expression has no effect
D:\server\gamemodes\ExtremeGame.pwn(16112) : warning 215: expression has no effect
D:\server\gamemodes\ExtremeGame.pwn(16112) : error 001: expected token: ";", but found ")"
D:\server\gamemodes\ExtremeGame.pwn(16112) : error 029: invalid expression, assumed zero
D:\server\gamemodes\ExtremeGame.pwn(16112) : fatal error 107: too many error messages on one line
Lines are:
16112: if(GetPVarInt(i, "Cover") == 0) SendAdminMessage(COLOR_WARNING, string,1);
4740: foreach(Player, i) {

The function is:

Код:
function GetAdmins() {
	new x;
	foreach(Player, i) {
		if(IsPlayerConnected(i) && PlayerInfo[i][pAdmin] >= 1) x++;
	}
	return x;
}



Re: Line 5 errors - solstice_ - 07.02.2018

PHP код:
stock GetAdmins()
{
    foreach(
Playeri)
    {
        if(
IsPlayerConnected(i))
        {
            new 
x;
            if(
PlayerInfo[i][pAdmin] >= 1)
            
x++;
        }
    }
    return 
x;

Try this and tell me if it works, p.s can you try to explain to me what is that "x" there for? I just added it because i saw it in your code i don't even know what it is