[help] 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: [help] playerid (
/showthread.php?tid=85607)
[help] playerid -
Marc_307 - 08.07.2009
How to use "SendClientMessage(playerid,color,"text");" in "OnVehicleDeath(vehicleid,killerid)"

If you use is normaly, the compiler says "Undefined Symbol.".
Re: [help] playerid -
refshal - 08.07.2009
Maybe you added it wrong. What did you do? Try to show what you did. And show the error too.
Re: [help] playerid -
Marc_307 - 08.07.2009
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;
}
Re: [help] playerid -
JaTochNietDan - 08.07.2009
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
Re: [help] playerid -
Marc_307 - 08.07.2009
And how to set "playerid"?
Re: [help] playerid -
JaTochNietDan - 08.07.2009
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
Re: [help] playerid -
Correlli - 08.07.2009
Try to check if killerid is a player and send a message to him.
Re: [help] playerid -
Jefff - 08.07.2009
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