error 008: must be a constant expression; assumed zero -
TheKnown - 17.10.2014
I got this error :
Код:
C:\Users\Nikola\Desktop\Papki\samp\gamemodes\Trucking1.pwn(20829) : error 008: must be a constant expression; assumed zero
C:\Users\Nikola\Desktop\Papki\samp\gamemodes\Trucking1.pwn(20829) : error 008: must be a constant expression; assumed zero
C:\Users\Nikola\Desktop\Papki\samp\gamemodes\Trucking1.pwn(20829) : error 036: empty statement
C:\Users\Nikola\Desktop\Papki\samp\gamemodes\Trucking1.pwn(20829) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
4 Errors.
line 20829:
Код:
new PlayerVehicle[playerid] = GetPlayerVehicleID(playerid);
Full:
Код:
public OnPlayerStateChange(playerid,newstate,oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
new PlayerVehicle[playerid] = GetPlayerVehicleID(playerid);
}
if(Vehicle == admincar)
{
if(APlayerData[playerid][PlayerLevel] >= 1) // change to your admin definition
{
SendClientMessage(playerid, COLOR_YELLOW, "* Welcome Back Admin!");
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "* You got spooked by the alarm system");
RemovePlayerFromVehicle(playerid);
}
return 1;
}
Help me please!
Re: error 008: must be a constant expression; assumed zero -
DanishHaq - 17.10.2014
Assuming var admincar is already defined as the vehicle of the admin:
pawn Код:
public OnPlayerStateChange(playerid,newstate,oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
new PlayerVehicle = GetPlayerVehicleID(playerid); // I removed the [playerid] here, it's not needed
// don't close the bracket yet!
if(PlayerVehicle == admincar) // you need to check if the PlayerVehicle is that car, the variable must be the same as above
{
if(APlayerData[playerid][PlayerLevel] >= 1)
{
SendClientMessage(playerid, COLOR_YELLOW, "*Welcome Back Admin!");
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "*You got spooked by the alarm system");
RemovePlayerFromVehicle(playerid);
}
}
return 1;
}
Read what I said in the comments.
Re: error 008: must be a constant expression; assumed zero -
TheKnown - 17.10.2014
Omg ty dude +rep for the help
Re: error 008: must be a constant expression; assumed zero -
TheKnown - 17.10.2014
Umm when i enter any kind of car it removes me from the car,but i am an admin
Re: error 008: must be a constant expression; assumed zero -
Abagail - 17.10.2014
Try
pawn Код:
{
if(APlayerData[playerid][PlayerLevel] >= 1)
{
SendClientMessage(playerid, COLOR_YELLOW, "*Welcome Back Admin!");
}
else
{
SendClientMessage(playerid, COLOR_RED, "*You got spooked by the alarm system");
RemovePlayerFromVehicle(playerid);
}
}
The else was misplaced.
Re: error 008: must be a constant expression; assumed zero -
TheKnown - 17.10.2014
Код:
C:\Users\Nikola\Desktop\Papki\samp\gamemodes\Trucking1.pwn(20838) : warning 217: loose indentation
C:\Users\Nikola\Desktop\Papki\samp\gamemodes\Trucking1.pwn(20845) : warning 217: loose indentation
C:\Users\Nikola\Desktop\Papki\samp\gamemodes\Trucking1.pwn(20938) : error 079: inconsistent return types (array & non-array)
C:\Users\Nikola\Desktop\Papki\samp\gamemodes\Trucking1.pwn(20944) : warning 217: loose indentation
C:\Users\Nikola\Desktop\Papki\samp\gamemodes\Trucking1.pwn(20944) : error 029: invalid expression, assumed zero
C:\Users\Nikola\Desktop\Papki\samp\gamemodes\Trucking1.pwn(20944) : error 004: function "OnPlayerKeyStateChange" is not implemented
C:\Users\Nikola\Desktop\Papki\samp\gamemodes\Trucking1.pwn(20960) : error 017: undefined symbol "newkeys"
C:\Users\Nikola\Desktop\Papki\samp\gamemodes\Trucking1.pwn(20964) : error 017: undefined symbol "newkeys"
C:\Users\Nikola\Desktop\Papki\samp\gamemodes\Trucking1.pwn(20970) : error 017: undefined symbol "newkeys"
C:\Users\Nikola\Desktop\Papki\samp\gamemodes\Trucking1.pwn(20974) : error 017: undefined symbol "newkeys"
C:\Users\Nikola\Desktop\Papki\samp\gamemodes\Trucking1.pwn(20984) : error 017: undefined symbol "newkeys"
C:\Users\Nikola\Desktop\Papki\samp\gamemodes\Trucking1.pwn(20987) : error 017: undefined symbol "GetClosestVehicle"
C:\Users\Nikola\Desktop\Papki\samp\gamemodes\Trucking1.pwn(20988) : error 017: undefined symbol "VehicleToPlayer"
C:\Users\Nikola\Desktop\Papki\samp\gamemodes\Trucking1.pwn(20995) : error 017: undefined symbol "newkeys"
C:\Users\Nikola\Desktop\Papki\samp\gamemodes\Trucking1.pwn(21019) : error 079: inconsistent return types (array & non-array)
C:\Users\Nikola\Desktop\Papki\samp\gamemodes\Trucking1.pwn(21024) : warning 225: unreachable code
C:\Users\Nikola\Desktop\Papki\samp\gamemodes\Trucking1.pwn(21024) : error 029: invalid expression, assumed zero
C:\Users\Nikola\Desktop\Papki\samp\gamemodes\Trucking1.pwn(21024) : error 017: undefined symbol "VehicleToPlayer"
C:\Users\Nikola\Desktop\Papki\samp\gamemodes\Trucking1.pwn(21026) : error 029: invalid expression, assumed zero
C:\Users\Nikola\Desktop\Papki\samp\gamemodes\Trucking1.pwn(21026) : error 017: undefined symbol "VehicleToPlayer"
C:\Users\Nikola\Desktop\Papki\samp\gamemodes\Trucking1.pwn(21033) : error 017: undefined symbol "vehicleid"
C:\Users\Nikola\Desktop\Papki\samp\gamemodes\Trucking1.pwn(21037) : error 079: inconsistent return types (array & non-array)
C:\Users\Nikola\Desktop\Papki\samp\gamemodes\Trucking1.pwn(21042) : warning 225: unreachable code
C:\Users\Nikola\Desktop\Papki\samp\gamemodes\Trucking1.pwn(21042) : error 029: invalid expression, assumed zero
C:\Users\Nikola\Desktop\Papki\samp\gamemodes\Trucking1.pwn(21042) : error 017: undefined symbol "GetClosestVehicle"
C:\Users\Nikola\Desktop\Papki\samp\gamemodes\Trucking1.pwn(21044) : error 029: invalid expression, assumed zero
C:\Users\Nikola\Desktop\Papki\samp\gamemodes\Trucking1.pwn(21044) : error 017: undefined symbol "GetClosestVehicle"
C:\Users\Nikola\Desktop\Papki\samp\gamemodes\Trucking1.pwn(21055) : error 017: undefined symbol "VehicleToPlayer"
C:\Users\Nikola\Desktop\Papki\samp\gamemodes\Trucking1.pwn(21068) : error 079: inconsistent return types (array & non-array)
C:\Users\Nikola\Desktop\Papki\samp\gamemodes\Trucking1.pwn(21074) : warning 225: unreachable code
C:\Users\Nikola\Desktop\Papki\samp\gamemodes\Trucking1.pwn(21074) : error 029: invalid expression, assumed zero
C:\Users\Nikola\Desktop\Papki\samp\gamemodes\Trucking1.pwn(21074) : error 017: undefined symbol "DebugKeys"
Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
26 Errors.
Re: error 008: must be a constant expression; assumed zero -
Rudy_ - 18.10.2014
pawn Код:
public OnPlayerStateChange(playerid,newstate,oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
new PlayerVehicle = GetPlayerVehicleID(playerid); // I removed the [playerid] here, it's not needed
// don't close the bracket yet!
if(PlayerVehicle == admincar) // you need to check if the PlayerVehicle is that car, the variable must be the same as above
{
if(APlayerData[playerid][PlayerLevel] >= 1)
{
SendClientMessage(playerid, COLOR_YELLOW, "*Welcome Back Admin!");
}
else
{
SendClientMessage(playerid, COLOR_RED, "*You got spooked by the alarm system");
RemovePlayerFromVehicle(playerid);
}
}
}
return 1;
}
Re: error 008: must be a constant expression; assumed zero -
DanishHaq - 20.10.2014
My bad; I forgot to change stuff. Assuming that if a player enters any other vehicle the alarm system won't go off implying the alarm system only goes off when an admin level 0 enters an admin vehicle; this should work:
pawn Код:
public OnPlayerStateChange(playerid,newstate,oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
new PlayerVehicle = GetPlayerVehicleID(playerid);
if(PlayerVehicle == admincar)
{
if(APlayerData[playerid][PlayerLevel] >= 1)
{
SendClientMessage(playerid, COLOR_YELLOW, "*Welcome Back Admin!");
}
else
{
SendClientMessage(playerid, COLOR_RED, "*You got spooked by the alarm system");
RemovePlayerFromVehicle(playerid);
}
}
}
return 1;
}