Just one more thing: Do yourself and everybody in this Forum a favor - If you are not sure if something works - try it. And if you come across something which you do not know how to do: Just research some stuff on your own and think of a solution yourself before asking.
I just did but cant find out how to do that like just want to know this one thing so I can experiment
nope definitely cant find anything on google about how to do if player enters something in the console it will do something
the console isn’t for using command , people using chat system for sending command.
otherwise if you prefere using a menu you can do it with html by NUI or with NativeUI (who provide you rdy-to-use menu)
like I want to know the code for the chat thing then so if some one does /freeze something happens but not sure hoe to make the code for /freeze
as @Payzman said , take more time looking on forum with right word , and you will find most of thing you looking for , your answer is already wrote there : https://forum.cfx.re/t/release-car-spawning-via-chat-commands/7761
oh sorry ill do that next time
but this is lua isn’t it or is it c#
it’s about Eventhandlers and TriggerClientEvent / TriggerServerEvent , it’s the same in lua or c# , just the way you type it who is different.
ok thanks this helps
in c# for receive event server or client side , you have to create it in your constructor :
class myClass : BaseScript
{
public myClass()
{
EventHandlers["freezePed"] += new Action<dynamic,dynamic>(myReceiveFunc);
}
private void myReceiveFunc(dynamic param1,dynamic param2)
{
// Do your stuff here
}
}
now you have create and event who can receive your param and do something with it.
now for trigger event from server side :
private void myFunctionTrigger()
{
TriggerClientEvent(player,"nameOfEventClientSide",param1,param2);
}
ps: it’s an overload on the function triggerclientevent who take no player on param (i never use it yet , but i think it will send to anyplayer connect)
on client side for trigger event on server :
private void myFunctionTrigger()
{
TriggerServerEvent("nameOfEventServerSide",param1,param2);
}
so do I make client file with the first part of code and put other part in server file
thanks I am going to test it out now thanks so much I am very new to scripting just started yesterday you see but this helps me understand it a lot better thanks
of course you have to make 2 different script (dll) , one will run on server side the other on client side .
some function you will found are only server side vice-versa
yes but thanks for this
do I do the code for /freeze or is that already done
you should do it , it’s a simple script to do , best thing for start.
try it , and if it’s not working you can still post your code and getting help.
(i prefer helping people who try something then just requesting script)
yeh but I didn’t know where to start as I’m new to this
ill try and do it now thanks for all your help