Editing built in function prototypes
#1

Specifically I want to edit OnVehicleDeath(vehicleid,killerid)
to accept another parameter so that it reads OnVehicleDeath(playerid, vehicleid,killerid)

when i just change it on the gamemode.pwn it says it does not match prototype
so my question is where is the prototype and if I find it can I just go ahead and add the extra parameter
Reply
#2

You can't change that. And honestly why would you even want to? What would be the purpose of the playerid parameter? You already have killerid.
Reply
#3

It wouldn't work even if you changed it. You must actually write some code for it to work.
Example, this will find the driver of the vehicle or passenger and send him a message:

Код:
public OnVehicleDeath(vehicleid, killerid)
{
for(new player=0;player<MAX_PLAYERS;++player)
if(IsPlayerConnected(player) && IsPlayerInAnyVehicle(player) && GetPlayerVehicleID(player) == vehicleid)
{
if(GetPlayerState(player) == PLAYER_STATE_DRIVER )
    SendClientMessage(playerid,0xFF000000,"You died inside your car as a driver.");
else  if (GetPlayerState(player) == PLAYER_STATE_PASSENGER)
SendClientMessage(playerid,0xFF000000,"You died inside your car as a passenger.");
}
return 1;
}
Reply
#4

im trying to call a custom function that uses playerid as a parameter to destroy the specific vehicle id based on what team the player chose, so that the vehicle doesnt respawn until the next round



the function would look something like this:
Код:
if(GetPlayerSkin(playerid) == 198){
DestroyVehicle(vehicleid);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)