Hello,
I just post something here, 'cause i have a good question
I need to check if an entity Exist, and if she doesn’t, just Create an Entity, but with a Specified ID
Example :
just for Check : if i PRINT a my PlayerPed the console Return me That :
TriggerServerEvent(‘PRINT’, GetPlayerPed(-1)…" JUST PRINT MY PED"’)
---- CONSOLE —> : 24846 JUST PRINT MY PED (value JUST PRINT MY PED)
but now i check if a specified Entity EXIST OR NOT:
if DoesEntityExist(GetPlayerPed(-1)) then
TriggerServerEvent(‘PRINT’, GetPlayerPed(-1)…" JUST PRINT MY PED EXIST"’)
else
TriggerServerEvent(‘PRINT’, “NOPE BRO, DOESn’t EXIST”)
end
-------- now the console just say me if my ped exist or not BUT !
if want do something else, because i know :
A value of an Entity it isn’t same for all CLIENTS
EXAMPLE :
a value of a Vehicle for me it’s 20000 but maybe for an other Client the value can me 20100 (for exemple)
ok now i can tell what i want,
i want a value for an Entity, with SAME VALUE for any CLIENT SO : if gonna call a good value
GetPlayerServerId(GetPlayerIndex())
if DoesEntityExist(GetPlayerServerId(GetPlayerIndex())) then ------- maybe my value it’s “7” for exemple
–DO OK MY ENTITY EXIST
else
– DO OK MY ENTITY DOESN’T EXIST SO I CREATE A NEW ENTITY BUT, SET THE ID OF
THIS ENTITY TO 7
end
so my question is : can i create an entity with specified ID for if i PRINT the console Return me my specified Value ?
Thx for read
sorry for bad english
1 Like
I had the same issue, and the only way I found yet to synchronize a value is to set a “decorator” value : DecorSetInt
to the entity,.
But the thing is, I’m not sure this function can be used on the server side…
This method is used for exemple to make fuel tank capacity for each vehicle synchronized with all players.
I’m not sure it helps for your case, but I think it’s a good thing to know about
1 Like
Yes i use it but the Entity “value” between Client it isn’t the same so don’t work :’(
Ok maybe i’ve found something but for better Explications i’ve make a new PRINT
TEST 258 NAME :[GMT]CeiLciuZ #Ogrest FOR : KonScyence
TEST 55298 NAME :KonScyence FOR : KonScyence
TEST 59394 NAME :[GMT]CeiLciuZ #Ogrest FOR : [GMT]CeiLciuZ #Ogrest
TEST 29733 NAME :KonScyence FOR : [GMT]CeiLciuZ #Ogrest
As u can see, for KonScyence, my ID is 258 and his ID is 55298
BUT
For me KonScyence’s ID is 59394 and mine 29733
But i’ve found something i try id and i’ll be back
Ok it’s work perfectly thx… ^^
Nice ! How did you do then ?
I was trying to understand what you could possibly try with your previous test, but I didn’t found out
@CeiLciuZ What exactly have you done? DId you work with the decorators?
yep with decorator but, u know i say that
TEST 258 NAME :[GMT]CeiLciuZ #Ogrest FOR : KonScyence
TEST 55298 NAME :KonScyence FOR : KonScyence
TEST 59394 NAME :[GMT]CeiLciuZ #Ogrest FOR : [GMT]CeiLciuZ #Ogrest
TEST 29733 NAME :KonScyence FOR : [GMT]CeiLciuZ #Ogrest
So i need to do something else, i just run a stress TEST now on my server for check LAggy and if i see nothing bad,
i tell u the method
So now i can save a value in any player and request it from any client
Example a RPNAME
https://gyazo.com/47997376643788835c97f2e5690d80aa
@CeiLciuZ Just wondering… how do you save the rp name? You can’t save a decorator as a string.
2 Likes
u can’t save a string in decor but
u can convert string to Byte and save this byte and re-translate this byte to char easly
just Think about and u can find
DecorSetInt is synchronized with all client ?
Omg thanks for rapid reply im need syncrhonize vehicle for persistant and im use nextVehicle() for retrieve véhicle and this function is not correct all time and network function is rotten.
im search while two week another function for verify if this véhicle exist ^^