[Help] SetVehicleNumberPlate
#1

Okay, i created a command which saves your vehicle number plate on the database, the thing is that i don't know how to load that numberplate when the player enters the server, yes the vehicle plate is saved on the player account, same as his vehicle. The variable i use is this one: pCarPlate, how can i load it when the vehicle saved to that player account spawns?
Reply
#2

If you are using dini or some other ini system, try to find the function that loads that variable.
You'll need to add the scripts in OnPlayerStateChange.
When the player changes his state as driver,
check his vehicle's model whether it has a numberplate or not,
and save its position, components,zangle,etc..
Then change its numberplate and respawn it,
and finally restore the position,components,etc.,
and put the driver as passengers back to the vehicle.
Reply
#3

Quote:
Originally Posted by leong124
Посмотреть сообщение
If you are using dini or some other ini system, try to find the function that loads that variable.
You'll need to add the scripts in OnPlayerStateChange.
When the player changes his state as driver,
check his vehicle's model whether it has a numberplate or not,
and save its position, components,zangle,etc..
Then change its numberplate and respawn it,
and finally restore the position,components,etc.,
and put the driver as passengers back to the vehicle.
I use MySQL, that would work, but it must have another way, because always you enter a vehicle and respawn it could be really annoying.
Reply
#4

There's no other way, I think.
Changing numberplate requires the vehicle to respawn to take effect.
Reply
#5

It doesn't really require a respawn. It requires the vehicle to restream (if someone already sees it). In other words, setting the numberplate after CreateVehicle() is fine.
Reply
#6

Is toggling virtual worlds or interiors considered as a re-stream to the server?
Reply
#7

Quote:
Originally Posted by Simon
Посмотреть сообщение
Is toggling virtual worlds or interiors considered as a re-stream to the server?
Yes. Virtual worlds are actually just different streaming channels on the server. Interiors are different streaming channels on the client - in the actual game engine itself.
Reply
#8

Quote:
Originally Posted by Kalcor
Посмотреть сообщение
It doesn't really require a respawn. It requires the vehicle to restream (if someone already sees it). In other words, setting the numberplate after CreateVehicle() is fine.
Thanks for the reply, I'll try that, dumb me.
Reply
#9

Quote:
Originally Posted by Simon
Посмотреть сообщение
Is toggling virtual worlds or interiors considered as a re-stream to the server?
However, you need to set different virtual world to the vehicle for more than 1000ms (default stream_rate) so it has any effect for players
Reply
#10

https://sampforum.blast.hk/showthread.php?tid=194734

Quote:
Originally Posted by Kalcor
Посмотреть сообщение
It doesn't really require a respawn. It requires the vehicle to restream (if someone already sees it). In other words, setting the numberplate after CreateVehicle() is fine.
Then, will this work?
Код:
public OnVehicleStreamIn(vehicleid, forplayerid)
{
    SetVehicleNumberPlate(vehicleid, "SAMPFTW");
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)