Liberty Unleashed
Scripting => Script Help => Topic started by: xxxMDjxxx on October 12, 2011, 05:56:54 pm
-
Hi, i cannot make this script to work:
function onScriptLoad()
{
CreateSphere( Vector( -368, 245.84, 61.02 ), 3.0, Colour( 0, 0, 255 ) )
return 1;
}
function onPlayerFootSphereHit( player, sphere )
{
if ( sphere.ID == 0 )
MessagePlayer( "Vila Janeza tretjega:", player, RED );
return 1;
}
function onPlayerSpawn( player, spawn )
{
if ( player.Name == "xXxMDjxXx" ) player.Pos = Vector( -368, 245.84, 61.02 );
return 1;
}
What is the problem? I can see the sphere, but when i walk into it nothing happens..
-
The signal you're using does not exist. Check the wiki for the right signal.
-
The signal you're using does not exist. Check the wiki for the right signal.
???Signal??? What???
-
The signal you're using does not exist. Check the wiki for the right signal.
???Signal??? What???
Signal/Event same thing, he's basically saying that onPlayerFootSphereHit doesn't exist. You should be using
http://liberty-unleashed.co.uk/LUWiki/Squirrel/Server/Events/Sphere/onPlayerEnterSphere
If you read the wiki you wouldn't have to figure this out.
-
Ok, well sorry, but i was not being rude to him... I am yust a beginer with ideas and want to make stuff. The weird non existing
event is something i found on the forum and tried it, but the correct event isnot helping me to...
the code looks like this:
function onScriptLoad()
{
CreateSphere( Vector( -368, 245.84, 61.02 ), 3.0, Colour( 0, 0, 255 ) )
return 1;
}
function onPlayerEnterSphere( player, sphere )
{
if ( sphere.ID == 0 )
{
MessagePlayer( "Vila Janeza tretjega:", player, RED );
}
return 1;
}
function onPlayerSpawn( player, spawn )
{
if ( player.Name == "xXxMDjxXx" )
{
player.Pos = Vector( -368, 245.84, 61.02 );
}
return 1;
}
and the code onPlayerSpawn, doesent spawn me on that spot eather... idk what am i doing wrong...
And for the sphere, could it be the problem that i have more spheres in other scripts like fuelscript and car respray script, so that the id of this sphere is not 0, or is the sphere id defined for every script itself?
Modified--:
So now, the server gives an error :
AN ERROR HAS OCCURED [getVarInfo: Could not retrieve UserData]
CALLSTACK
*FUNCTION [onPlayerEnterSphere()] Scripts/hise/hise.nut line [10]
LOCALS
[sphere] INSTANCE
[player] INSTANCE
[this] TABLE
AN ERROR HAS OCCURED [getVarInfo: Could not retrieve UserData]
CALLSTACK
*FUNCTION [onPlayerEnterSphere()] Scripts/hise/hise.nut line [10]
LOCALS
[sphere] INSTANCE
[player] INSTANCE
[this] TABLE
-
MessagePlayer( "Vila Janeza tretjega:", player, RED );
Does RED even exist? You should be doing 255, 0, 0 for red in MessagePlayer.
MessagePlayer( "Vila Janeza tretjega:", player, 255, 0, 0 );
As for the onPlayerSpawn code I have no idea.
-
WORKS! ooooh thanx man you are the greatest! ;D
-
if ( player.Name == "xXxMDjxXx" )
This is case sensitive. If one letter isn't in caps as it should be, it will fail. This should work:
if ( player.Name.tolower() == "xxxmdjxxx" )