SA-MP Forums Archive
Error 017:Undefined Symbol "printf" - 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 017:Undefined Symbol "printf" (/showthread.php?tid=661378)



Error 017:Undefined Symbol "printf" - Min99 - 02.12.2018

This is the error.
Quote:

: warning 235: public function lacks forward declaration (symbol "OnVehicleMod")
: error 017: undefined symbol "printf"
: warning 215: expression has no effect
: error 001: expected token: ";", but found "]"
: error 029: invalid expression, assumed zero
: fatal error 107: too many error messages on one line

I need help on this.

Код:
public OnVehicleMod(playerid, vehicleid, componentid)
{
	printf("[OnVehicleMod]: '%s(%d)' has attached %d on %d", pName[playerid], playerid, componentid, vehicleid);
 	if(BoughtVehicle[playerid] == true)
	{
		if(vehicleid == PlayerVehicle[playerid])
		{
			SavePVComponents(playerid, componentid);
		}
	}
	if(GetPlayerInterior(playerid) == 0)
 	{
  		format(str, sizeof(str), "* ADMIN-MSG: "GREY_E"%s(%i) has attempted to install an invalid vehicle mod.", pName[playerid], playerid);
		SendAdminMessage(COLOR_RED, str);
  		return 0;
    }
	new vehicleide = GetVehicleModel(vehicleid);
    new modok = islegalcarmod(vehicleide, componentid);
    if (!modok)
	{
        printf("[invalid_mod] %s %d %d %d %d %d", pName[playerid], playerid, vehicleid, vehicleide, componentid);
        format(str, sizeof(str), "4Anti-Cheat 4%s(%i) has been kicked for attempting to install an invalid vehicle mod.", pName[playerid], playerid);
		IRC_GroupSay(ircGroup, IRC_CHANNEL, str), IRC_GroupSay(ircGroup, IRC_aCHANNEL, str);
		format(str, sizeof(str), ""GREY_E"Anti-Cheat: "RED_E"%s(%i) has been kicked for attempting to install an invalid vehicle mod.", pName[playerid], playerid);
		SendClientMessageToAll(COLOR_RED, str);
        Kick(playerid);
        return 0;
    }
    return 1;
}



Re: Error 017:Undefined Symbol "printf" - GloomY - 03.12.2018

pawn Код:
public OnVehicleMod(playerid, vehicleid, componentid)
{
    printf("[OnVehicleMod]: '%s(%d)' has attached %d on %d", pName[playerid], playerid, componentid, vehicleid);
    if(BoughtVehicle[playerid] == true)
    {
        if(vehicleid == PlayerVehicle[playerid])
        {
            SavePVComponents(playerid, componentid);
        }
    }
    if(GetPlayerInterior(playerid) == 0)
    {
        format(str, sizeof(str), "* ADMIN-MSG: "GREY_E"%s(%i) has attempted to install an invalid vehicle mod.", pName[playerid], playerid);
        SendAdminMessage(COLOR_RED, str);
        return 0;
    }
    new vehicleide = GetVehicleModel(vehicleid);
    new modok = islegalcarmod(vehicleide, componentid);
    if (!modok)
    {
        printf("[invalid_mod] %s %d %d %d %d", pName[playerid], playerid, vehicleid, vehicleide, componentid);
        format(str, sizeof(str), "4Anti-Cheat 4%s(%i) has been kicked for attempting to install an invalid vehicle mod.", pName[playerid], playerid);
        IRC_GroupSay(ircGroup, IRC_CHANNEL, str), IRC_GroupSay(ircGroup, IRC_aCHANNEL, str);
        format(str, sizeof(str), ""GREY_E"Anti-Cheat: "RED_E"%s(%i) has been kicked for attempting to install an invalid vehicle mod.", pName[playerid], playerid);
        SendClientMessageToAll(COLOR_RED, str);
        Kick(playerid);
        return 0;
    }
    return 1;
}



Re: Error 017:Undefined Symbol "printf" - Doddinger - 03.12.2018

Forward the function. The variables have to be declared. Also read here:
forward OnVehicleMod(playerid, vehicleid, componentid);

https://sampforum.blast.hk/showthread.php?tid=152262

And for the other error you should give us at least the lines.

you could also try to find out how to fix that: expected token: ";", but found "]"

by yourself. That's actually a pretty little mistake and it's mostly easy to solve.