SetVehicleNumberPlate does not work for me - 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: SetVehicleNumberPlate does not work for me (
/showthread.php?tid=218538)
SetVehicleNumberPlate does not work for me -
Divine - 30.01.2011
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
new name[32], VID;
VID = GetPlayerVehicleID(playerid);
GetPlayerName(playerid,name,sizeof(name));
SetVehicleNumberPlate(VID,name);
SetVehicleToRespawn(VID);
return 1;
}
No effect... Does not set the name, does not respawn either... wtf?
Re: SetVehicleNumberPlate does not work for me -
[NoV]LaZ - 30.01.2011
GetPlayerVehicleID will return 0 when OnPlayerEnterVehicle is called because the player is not in that vehicle at that time, so that's why it doesn't work. You have the vehicleid parameter there, why don't you use it ?
Re: SetVehicleNumberPlate does not work for me -
Divine - 30.01.2011
Quote:
Originally Posted by [NoV]LaZ
GetPlayerVehicleID will return 0 when OnPlayerEnterVehicle is called because the player is not in that vehicle at that time, so that's why it doesn't work. You have the vehicleid parameter there, why don't you use it ?
|
Sorry I dont get it ;|
Re: SetVehicleNumberPlate does not work for me -
Not available - 30.01.2011
He means you have to do it this way:
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
new
name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
SetVehicleNumberPlate(vehicleid, name);
SetVehicleToRespawn(vehicleid);
return 1;
}
Please note that if the player enters the vehicle and it's moved from it's original spawning position it won't respawn where the player is. This can be avoided by doing this:
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
new
name[MAX_PLAYER_NAME], vx, vy, vz;
GetPlayerName(playerid, name, sizeof(name));
SetVehicleNumberPlate(vehicleid, name);
SetVehicleToRespawn(vehicleid);
SetVehiclePos(vehicleid, vx, vy, vz);
PutPlayerInVehicle(playerid, vehicleid, 0);
return 1;
}
Re: SetVehicleNumberPlate does not work for me -
Divine - 30.01.2011
Quote:
Originally Posted by Not available
He means you have to do it this way:
Please note that if the player enters the vehicle and it's moved from it's original spawning position it won't respawn where the player is. This can be avoided by doing this:
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) { new name[MAX_PLAYER_NAME], vx, vy, vz; GetPlayerName(playerid, name, sizeof(name)); SetVehicleNumberPlate(vehicleid, name); SetVehicleToRespawn(vehicleid); SetVehiclePos(vehicleid, vx, vy, vz); PutPlayerInVehicle(playerid, vehicleid, 0); return 1; }
|
works now...
but another problem now...
when I use a command like /car .. it puts me in to the vehicle automaticly...
but when i leave the vehicle it dissapears... o.O
Re: SetVehicleNumberPlate does not work for me -
Not available - 30.01.2011
Are you setting the vehicle to clear nameplate and respawn when player exits the vehicle?
Re: SetVehicleNumberPlate does not work for me -
Divine - 30.01.2011
Quote:
Originally Posted by Not available
Are you setting the vehicle to clear nameplate and respawn when player exits the vehicle?
|
nope..