4 errors and a few warnings
#1

Hello guys am having a issue adding AVS vehicle system you can find that on the filterscripts.

anyways am trying to add it to my gamemode it wont happen keep getting errors logs below.


Код:
C:\Users\Brandon\Desktop\Roleplay\gamemodes\RP.pwn(44) : warning 201: redefinition of constant/macro (symbol "MAX_PLAYER_VEHICLES")
C:\Users\Brandon\Desktop\Roleplay\gamemodes\RP.pwn(140) : warning 201: redefinition of constant/macro (symbol "CMD:%1(%2)")
C:\Users\Brandon\Desktop\Roleplay\gamemodes\RP.pwn(510) : warning 219: local variable "pName" shadows a variable at a preceding level
C:\Users\Brandon\Desktop\Roleplay\gamemodes\RP.pwn(511) : error 035: argument type mismatch (argument 2)
C:\Users\Brandon\Desktop\Roleplay\gamemodes\RP.pwn(510) : warning 204: symbol is assigned a value that is never used: "pName"
C:\Users\Brandon\Desktop\Roleplay\gamemodes\RP.pwn(840) : error 035: argument type mismatch (argument 2)
C:\Users\Brandon\Desktop\Roleplay\gamemodes\RP.pwn(1055) : warning 202: number of arguments does not match definition
C:\Users\Brandon\Desktop\Roleplay\gamemodes\RP.pwn(1055) : warning 202: number of arguments does not match definition
C:\Users\Brandon\Desktop\Roleplay\gamemodes\RP.pwn(1055) : error 035: argument type mismatch (argument 2)
C:\Users\Brandon\Desktop\Roleplay\gamemodes\RP.pwn(1055) : error 035: argument type mismatch (argument 2)
C:\Users\Brandon\Desktop\Roleplay\gamemodes\RP.pwn(6624) : warning 219: local variable "PlayerName" shadows a variable at a preceding level
C:\Users\Brandon\Desktop\Roleplay\gamemodes\RP.pwn(8488) : warning 219: local variable "PlayerName" shadows a variable at a preceding level
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.


error line 511
Код:
stock PlayerName(playerid)
{
	new pName[MAX_PLAYER_NAME];
	GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
	return pName;
}
Error line 840
Код:
GetPlayerVehicleAccess(playerid, vehicleid)
{
	if(IsValidVehicle(vehicleid))
	{
		if(VehicleCreated[vehicleid] == VEHICLE_DEALERSHIP)
		{
			if(IsAdmin(playerid, 1))
			{
				return 1;
			}
		}
		else if(VehicleCreated[vehicleid] == VEHICLE_PLAYER)
		{
			if(strcmp(VehicleOwner[vehicleid], PlayerName(playerid)) == 0)
			{
				return 2;
			}
			else if(GetPVarInt(playerid, "CarKeys") == vehicleid)
			{
				return 1;
			}
		}
	}
	else
	{
		return 1;
	}
	return 0;
}
Error line 1055
Код:
public Speedometer()
{
	new vehicleid, Float:health;
	new engine, lights, alarm, doors, bonnet, boot, objective;
	new fstring[32], string[512];

	for(new i=0; i < MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i))
		{
			vehicleid = GetPlayerVehicleID(i);
			GetVehicleHealth(vehicleid, health);
			GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);

			string = "~b~~h~vehicle: ~w~";
			strcat(string, VehicleNames[GetVehicleModel(vehicleid)-400], sizeof(string));

			strcat(string, "~n~~b~~h~gps: ~w~", sizeof(string));
			strcat(string, GetPlayer3DZone(i), sizeof(string));

			strcat(string, "~n~~b~~h~health: ~g~", sizeof(string));
			fstring = "iiiiiiiiii";
			if(health > 1000.0) strins(fstring, "~r~", 10, sizeof(fstring));
			else if(health < 0.0) strins(fstring, "~r~", 0, sizeof(fstring));
			else strins(fstring, "~r~", floatround(health/100.0), sizeof(fstring));
			strcat(string, fstring, sizeof(string));

			strcat(string, "        ~b~~h~fuel: ~g~", sizeof(string));
			fstring = "iiiiiiiiii";
			if(Fuel[vehicleid] > 100.0) strins(fstring, "~r~", 10, sizeof(fstring));
			else if(Fuel[vehicleid] < 0.0) strins(fstring, "~r~", 0, sizeof(fstring));
			else strins(fstring, "~r~", floatround(Fuel[vehicleid]/10.0), sizeof(fstring));
			strcat(string, fstring, sizeof(string));

			strcat(string, "        ~b~~h~", sizeof(string));
			if(GetPVarInt(i, "Speedo")) format(fstring,sizeof(fstring),"mph: ~w~%d", GetPlayerSpeed(i, false));
			else format(fstring,sizeof(fstring),"kph: ~w~%d", GetPlayerSpeed(i, true));
			strcat(string, fstring, sizeof(string));

			strcat(string, "~n~~b~~h~engine: ", sizeof(string));
			if(engine == 1) strcat(string, "~g~on", sizeof(string));
			else strcat(string, "~r~off", sizeof(string));

			strcat(string, "        ~b~~h~alarm: ", sizeof(string));
			if(VehicleSecurity[vehicleid] == 1) strcat(string, "~g~on", sizeof(string));
			else strcat(string, "~r~off", sizeof(string));

			strcat(string, "        ~b~~h~doors: ", sizeof(string));
			if(doors == 1) strcat(string, "~r~locked", sizeof(string));
			else strcat(string, "~g~unlocked", sizeof(string));

			TextDrawSetString(SpeedoText[i], string);
		}
	}
}
Reply
#2

try changing the variable name:
PHP код:
stock PlayerName(playerid)
{
    new 
pname[MAX_PLAYER_NAME];
    
GetPlayerName(playeridpnameMAX_PLAYER_NAME);
    return 
pname;

Reply
#3

Quote:
Originally Posted by Captive
Посмотреть сообщение
try changing the variable name:
PHP код:
stock PlayerName(playerid)
{
    new 
pname[MAX_PLAYER_NAME];
    
GetPlayerName(playeridpnameMAX_PLAYER_NAME);
    return 
pname;

Nope still ant doing anything

can anyone help me. fix this please
Reply
#4

pawn Код:
GetPlayerVehicleAccess(playerid, vehicleid)
{
    if(IsValidVehicle(vehicleid))
    {
        if(VehicleCreated[vehicleid] == VEHICLE_DEALERSHIP)
        {
            if(IsAdmin(playerid, 1))
            {
                return 1;
            }
        }
        else if(VehicleCreated[vehicleid] == VEHICLE_PLAYER)
        {
            if(PlayerName(playerid) == VehicleOwner[playerid]) //to use strcmp vehicle Owner must be a string.
            {
                return 2;
            }
            else if(GetPVarInt(playerid, "CarKeys") == vehicleid)
            {
                return 1;
            }
        }
    }
    else
    {
        return 1;
    }
    return 0;
}
pawn Код:
stock PlayerName(playerid)
{
    new pName[24];
    GetPlayerName(playerid, pName, 24);
    return pName;
}
Which of those lines are the 1055?
Reply
#5

Quote:
Originally Posted by JustBored
Посмотреть сообщение
pawn Код:
GetPlayerVehicleAccess(playerid, vehicleid)
{
    if(IsValidVehicle(vehicleid))
    {
        if(VehicleCreated[vehicleid] == VEHICLE_DEALERSHIP)
        {
            if(IsAdmin(playerid, 1))
            {
                return 1;
            }
        }
        else if(VehicleCreated[vehicleid] == VEHICLE_PLAYER)
        {
            if(PlayerName(playerid) == VehicleOwner[playerid]) //to use strcmp vehicle Owner must be a string.
            {
                return 2;
            }
            else if(GetPVarInt(playerid, "CarKeys") == vehicleid)
            {
                return 1;
            }
        }
    }
    else
    {
        return 1;
    }
    return 0;
}
pawn Код:
stock PlayerName(playerid)
{
    new pName[24];
    GetPlayerName(playerid, pName, 24);
    return pName;
}
Which of those lines are the 1055?
am only getting 4 errors now i fixed others but this

Код:
2172) : error 012: invalid function call, not a valid address

Код:
GetPlayerVehicleAccess(playerid, vehicleid)
{
	if(IsValidVehicle(vehicleid))
	{
		if(VehicleCreated[vehicleid] == VEHICLE_DEALERSHIP)
		{
			if(IsAdmin(playerid, 1))
			{
				return 1;
			}
		}
		else if(VehicleCreated[vehicleid] == VEHICLE_PLAYER)
		{
			if(PlayerName(playerid) == VehicleOwner[playerid]) //to use strcmp vehicle Owner must be a string. 
			{
				return 2;
			}
			else if(GetPVarInt(playerid, "CarKeys") == vehicleid)
			{
				return 1;
			}
		}
	}
	else
	{
		return 1;
	}
	return 0;
}

COME ON GUYS AM REALLY NEED OF GETTING THIS FIXED.
Reply
#6

which line is 2172?
Reply
#7

can any1 help me with this please.


Код:
2172) : error 012: invalid function call, not a valid address
Код:
GetPlayerVehicleAccess(playerid, vehicleid)
{
	if(IsValidVehicle(vehicleid))
	{
		if(VehicleCreated[vehicleid] == VEHICLE_DEALERSHIP)
		{
			if(IsAdmin(playerid, 1))
			{
				return 1;
			}
		}
		else if(VehicleCreated[vehicleid] == VEHICLE_PLAYER)
		{
                         this line below coming up with a error  nvalid function call, not a valid address
			if(PlayerName(playerid) == VehicleOwner[playerid]) //to use strcmp vehicle Owner must be a string. 
			{
				return 2;
			}
			else if(GetPVarInt(playerid, "CarKeys") == vehicleid)
			{
				return 1;
			}
		}
	}
	else
	{
		return 1;
	}
	return 0;
}
Reply
#8

try this

old
Код:
stock PlayerName(playerid)
{
	new pName[MAX_PLAYER_NAME];
	GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
	return pName;
}
new
Код:
stock PlayerName(playerid)
{
	new pName[MAX_PLAYER_NAME];
	GetPlayerName(playerid, pName, sizeof(pName));
	return pName;
}
not sure it will fix your error , but this one work for me
Reply
#9

Try this,

pawn Код:
stock PlayerName(playerid)
{
    new Name[MAX_PLAYER_NAME + 1];
    GetPlayerName(playerid, Name, MAX_PLAYER_NAME + 1);
    return Name;
}
Reply
#10

okay thanks guys
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)