Sup everyone actually i am trying to achive send command from client side scripting
what ive tried so far
server side
functions
client side
@habi2 @vito
what ive tried so far
server side
Code Select
m <- BindKey(true,0x4D,0,0); //gamemodes
function onClientScriptData(player) {
local type = Stream.ReadInt();
if (type == 302) {
Stream.StartWrite();
Stream.WriteInt(302);
Stream.SendStream(player);
}
if (type == 303) {
Stream.ReadInt(303);
MessagePlayer("u r in drift", player);
onPlayerCommand(player , "drift", "");
}
}
functions
Code Select
function onKeyDown(player,key)
{
if( key == m )
{
if(player.World == 1)
{
Stream.StartWrite();
Stream.WriteInt(302);
Stream.SendStream(player);
}
}
}
client side
Code Select
function Server::ServerData(stream) {
local StreamReadInt = stream.ReadInt();
local StreamReadString = stream.ReadString();
switch (StreamReadInt.tointeger()) {
case 302:
GUI.SetMouseEnabled(true);
::spritedrift <- GUIButton(VectorScreen(400,380), VectorScreen(200, 22), Colour(75,75,75), "drift", GUI_FLAG_BORDER | GUI_FLAG_VISIBLE);
//::spritedrift <- GUISprite("drift.png", VectorScreen(1000, 600));
//::spritedrift.Size = VectorScreen(50, 50);
break;
}
}
function GUI::ElementClick(element, mousex, mousey)
{
GUI_ServerLogs.ElementClick( element );
if (element == spritedrift) {
Console.Print("Hello. welcome to VCMP")
local message = Stream();
message.WriteInt(303);
Server.SendData(message);
GUI.SetMouseEnabled(false);
::spritedrift <- null;
}
}
aim is to click a sprite that executes drift command@habi2 @vito