[help] playerid
#1

How to use "SendClientMessage(playerid,color,"text");" in "OnVehicleDeath(vehicleid,killerid)"
If you use is normaly, the compiler says "Undefined Symbol.".
Reply
#2

Maybe you added it wrong. What did you do? Try to show what you did. And show the error too.
Reply
#3

C:\Programme\Rockstar Games\Grand Theft Auto San Andreas\filterscripts\race.pwn(111) : error 017: undefined symbol "playerid"
pawn Код:
public OnVehicleDeath(vehicleid, killerid)
{
    SendClientMessage(playerid,RED,"Your car is destroyed!");//111
    return 1;
}
Reply
#4

Quote:
Originally Posted by Marc_307
C:\Programme\Rockstar Games\Grand Theft Auto San Andreas\filterscripts\race.pwn(111) : error 017: undefined symbol "playerid"
pawn Код:
public OnVehicleDeath(vehicleid, killerid)
{
    SendClientMessage(playerid,RED,"Your car is destroyed!");//111
    return 1;
}
That's because the OnVehicleDeath callback does not have a playerid defined! So you can't send the message to a playerid which isn't set
Reply
#5

And how to set "playerid"?
Reply
#6

You can't, the only way you can do what your trying to do is:

1. If the person is in the car when it blows up
2. If the person somehow owns the car, then you can store the vehicle ID a variable and use it in OnVehicleDeath
Reply
#7

Try to check if killerid is a player and send a message to him.
Reply
#8

Something like this but it works if u r in the water :/ when your vehicle is explode nothing happens
Код:
stock VehicleDriverID(vehicleid) // by I xD
{
	for(new i=0; i<GetMaxPlayers(); i++) if(IsPlayerConnected(i)) if(IsPlayerInVehicle(i,vehicleid)) if(GetPlayerState(i) == 2) return i;
	return -1;
}

public OnVehicleDeath(vehicleid, killerid)
{
	if(VehicleDriverID(vehicleid) != -1) {
		SendClientMessage(VehicleDriverID(vehicleid),0xAA3333AA,"Your car is destroyed!");
	}
	return 1;
}
Or use SetTimerEx to send this message with 2 sec after explode
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)