two problems with a callback
#1

SORRY FOR MY BAD ENGLISH: Hello guys, i have a big problem, callback 'OnVehicleDamageStatusUpdate' at my don't working...i have two functions for two diferent systems and this didn't work :C
Frist system send a message to a admin ( if admin are spec on you ) with vehicleid and player name.
And second sistem make trunk to be can't damaged, plates can't be bended...
CODE:
Код HTML:
public OnVehicleDamageStatusUpdate(vehicleid, playerid)
{
    new panels, doors, lights, tires;
    GetVehicleDamageStatus(vehicleid, panels, doors, lights, tires);
	new text[512];
	new rear_bumper = panels >> 24 & 15;
	foreach(Player, i)
	{
		if(Spectate[i] == playerid)
		{
	    	new name[25];
	    	GetPlayerName(playerid, name, 25);
	    	format(text, sizeof(text), "{ff9999}%s gived damage to vehicle %d.", name, vehicleid);
	    	
	    	SCM(i, -1, text);
		}
	}
	if(OwnedVeh(vehicleid))
	{
	    if(CarInfo[OwnedVeh(vehicleid)][cVIP] == 1)
	    {
	        if(GetVehicleModel(vehicleid) == 411 || GetVehicleModel(vehicleid) == 541 || GetVehicleModel(vehicleid) == 560)
	        {
	            
	            if(rear_bumper << 24)
	            {
	                rear_bumper = panels >> 24 & 15;
	                UpdateVehicleDamageStatus(vehicleid, rear_bumper, doors, lights, tires);
	            }
	        }
	    }
	}
	return 1;
}
Please help me ? it's my fault or callback fault ?
Reply
#2

For the first part, try adding print(f)() functions to see if something is happening (you know, debugging). Add it at the start of the callback -to see if it is actually called, in the foreach loop etc. That way you may find out your problem. Something might be wrong with the SCM function, for example.
Also, the OwnedVeh(vehicleid) function. What does it return? If it returns a boolean (is it owned;true/false|1/0) it is not so strange that your second system doesn't work;

If(CarInfo[OwnedVeh(vehicleid)][cVIP] == 1)

If the function only returns a boolean, the carinfo will only work for ID 0 and 1. Try replacing OwnedVeh(vehicleid) with just vehicleid (unless it actually returns the vehicleid, then I wouldn't know what might be wrong).
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)