create sprite as deleting it?

Started by Luis_Labarca, Sep 30, 2016, 02:16 AM

Previous topic - Next topic

Luis_Labarca



function Script::ScriptLoad()
{
GUI.SetMouseEnabled(true);
sprite <- GUISprite("s.png", VectorScreen(0, 0));
sprite.Size = VectorScreen(40, 40);
sprite.AddFlags(GUI_FLAG_MOUSECTRL);
}

Hello how do I delete a sprite that I have created?
My server RP
IP: 51.222.28.159:8194

Anik


KAKAN

sprite <- null;

function Script::ScriptLoad(){
//Set GUI mouse...
::GUI.SetMouseEnabled( true );
//Create the sprite and set the properties of it...
::sprite = GUISprite("s.png", VectorScreen(0, 0))
.AddFlags(GUI_FLAG_MOUSECTRL)
.Size = VectorScreen(40, 40);
}

function GUI::SomeEvent(){
// '=' doesn't work( in some cases, it does ), but assigning a slot does work.
::sprite <- null;
}
oh no

Luis_Labarca

My server RP
IP: 51.222.28.159:8194

Luis_Labarca

Quote from: KAKAN on Sep 30, 2016, 09:28 AMsprite <- null;

function Script::ScriptLoad(){
//Set GUI mouse...
::GUI.SetMouseEnabled( true );
//Create the sprite and set the properties of it...
::sprite = GUISprite("s.png", VectorScreen(0, 0))
.AddFlags(GUI_FLAG_MOUSECTRL)
.Size = VectorScreen(40, 40);
}

function GUI::SomeEvent(){
// '=' doesn't work( in some cases, it does ), but assigning a slot does work.
::sprite <- null;
}


Thanks bro I served but otherwise this was the way how I wore it and it worked thanks bro ;)



---Script server

function onClientScriptData(player)
{
local type = Stream.ReadInt();
if (type == 1)
{
Stream.StartWrite();
Stream.WriteInt(2);
Stream.SendStream(player);
}

if (type == 3)
{
Stream.StartWrite();
Stream.WriteInt(4);
Stream.SendStream(player);
}


}


Script Client-Side

keyJBind <- KeyBind(0x4A);
keyKBind <- KeyBind(0x4B);
sprite <- null;

function KeyBind::OnDown(keyBind)
{

if (keyBind == keyJBind)
{
local message = Stream();
message.WriteInt(1);
Server.SendData(message);
}

if (keyBind == keyKBind)
{
local message = Stream();
message.WriteInt(3);
Server.SendData(message);
}

}

function Server::ServerData(stream)
{
local type = stream.ReadInt();

if (type == 2) {//CreateSprit
::GUI.SetMouseEnabled(true);
::sprite <- GUISprite("s.png", VectorScreen(0, 0));
::sprite.Size = VectorScreen(40, 40);
::sprite.AddFlags(GUI_FLAG_MOUSECTRL);
}

if (type == 4) {//Delete Sprit
::GUI.SetMouseEnabled(false);
::sprite <- null;
}

}




My server RP
IP: 51.222.28.159:8194