Liberty Unleashed

Scripting => Script Help => Topic started by: xxxMDjxxx on October 12, 2011, 05:56:54 pm

Title: Spheres problem...
Post by: xxxMDjxxx on October 12, 2011, 05:56:54 pm
Hi, i cannot make this script to work:

Code: [Select]
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..
Title: Re: Spheres problem...
Post by: Thijn on October 12, 2011, 10:26:42 pm
The signal you're using does not exist. Check the wiki for the right signal.
Title: Re: Spheres problem...
Post by: xxxMDjxxx on October 13, 2011, 05:54:06 pm
The signal you're using does not exist. Check the wiki for the right signal.

???Signal??? What???
Title: Re: Spheres problem...
Post by: Force on October 13, 2011, 05:57:17 pm
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

Code: [Select]
http://liberty-unleashed.co.uk/LUWiki/Squirrel/Server/Events/Sphere/onPlayerEnterSphere

If you read the wiki you wouldn't have to figure this out.
Title: Re: Spheres problem...
Post by: xxxMDjxxx on October 14, 2011, 04:44:53 pm
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:
Code: [Select]
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
Title: Re: Spheres problem...
Post by: Force on October 14, 2011, 06:08:49 pm
Code: (squirrel) [Select]
MessagePlayer( "Vila Janeza tretjega:", player, RED );

Does RED even exist? You should be doing 255, 0, 0 for red in MessagePlayer.

Code: (squirrel) [Select]
MessagePlayer( "Vila Janeza tretjega:", player, 255, 0, 0 );

As for the onPlayerSpawn code I have no idea.
Title: Re: Spheres problem...
Post by: xxxMDjxxx on October 14, 2011, 07:03:55 pm
WORKS! ooooh thanx man you are the greatest!  ;D
Title: Re: Spheres problem...
Post by: stormeus on October 14, 2011, 08:54:24 pm
Code: [Select]
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:

Code: [Select]
if ( player.Name.tolower() == "xxxmdjxxx" )