SA-MP Forums Archive
undefined playerid. - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: undefined playerid. (/showthread.php?tid=218398)



undefined playerid. - THE_KNOWN - 30.01.2011

help:
Код:
public OnVehicleDeath(vehicleid, killerid)
{
	if(vehicleid == tvid[playerid])
	    {
	        DestroyVehicle(tvid[playerid]);
			for(new i=0;i<MAX_PLAYERS;i++)
			    {
			    new name[MAX_PLAYER_NAME];
				if(GetPlayerName(i, name, sizeof(name)) == owner[vid])
				    {
				    SendClientMessage(i, red, "Your vehicle has been destroyed.");
					}
				}
		}
	return 1;
}



Re: undefined playerid. - Antonio [G-RP] - 30.01.2011

Well, if you could read, the public function's paramaters don't allow you to use "playerid", only "vehicleid" and "killerid", I suggest changing "playerid" to "killerid", as that appears to be what you're going for.

pawn Код:
public OnVehicleDeath(vehicleid, killerid)
{
    if(vehicleid == tvid[killerid])
        {
            DestroyVehicle(tvid[killerid]);
            for(new i=0;i<MAX_PLAYERS;i++)
                {
                new name[MAX_PLAYER_NAME];
                if(GetPlayerName(i, name, sizeof(name)) == owner[vid])
                    {
                    SendClientMessage(i, red, "Your vehicle has been destroyed.");
                    }
                }
        }
    return 1;
}



Re: undefined playerid. - THE_KNOWN - 30.01.2011

ok thanks