Liberty Unleashed

Scripting => Script Help => Topic started by: Rifle168 on March 06, 2012, 04:09:09 pm

Title: Help
Post by: Rifle168 on March 06, 2012, 04:09:09 pm
Code: [Select]
pPlayer <- FindLocalPlayer();

function onClientRequestClass( pClass )
{
if ( pClass.ID == 0 ) SmallMessage( pClass, "Cop: Protect Liberty City From Criminals.", 5000, 1 );
else if ( pClass.ID == 2 )  SmallMessage( pClass,"Medic: Heal Citizens Of Liberty City.", 5000, 1 );
else if ( pClass.ID == 3 ) SmallMessage( pClass,"Bus Driver: Pick Up Citizens From Liberty City To Their Destination.", 5000, 1 );
else if ( pClass.ID == 4 ) SmallMessage( pClass,"Taxi Driver: Pick Up Citizens From Liberty City To Their Destination." 5000, 1 );
else SmallMessage( pClass,"Pick up Citizens from Liberty City to their destination", 5000, 1 );
return 1;
}

Code: [Select]
<script file="client.nut" client="1"/>It doesn't work or even executive.

Title: Re: Help
Post by: Thijn on March 06, 2012, 08:39:43 pm
try something like this:
Code: [Select]
--
His code is fine.

Are you sure you're loading the script in your Content.xml file?
Title: Re: Help
Post by: Rifle168 on March 07, 2012, 02:25:28 am
I have loaded the non-client scripts on Content.xml and on the Script.xml in the loaded folder i have
<script file="client.nut" client="1"/>

Still my client scripts doesn't work :(
Title: Re: Help
Post by: Thijn on March 07, 2012, 01:01:07 pm
The server side scripts must have: <script file="client.nut" client="0"/>
-facepalm-

I have loaded the non-client scripts on Content.xml and on the Script.xml in the loaded folder i have
<script file="client.nut" client="1"/>

Still my client scripts doesn't work :(
Can you post both your Content.xml and Script.xml files?
Title: Re: Help
Post by: Rifle168 on March 08, 2012, 02:25:07 am
Server Folder>Lu > Content.xml
Code: [Select]
<script folder="Main" />
Server Folder>Scripts>Main> Script.xml
Code: [Select]
<script file="main.nut" client="0" />
<script file="client.nut" client="1"/>

main.nut contains vbs and additional RP commands. Tested 1000 times so it works fine :)

Server Folder>Scripts>Main>client.nut

Code: [Select]
pPlayer <- FindLocalPlayer();

function onClientRequestClass( pClass )
{
if ( pClass.ID == 0 ) SmallMessage( pClass, "Cop: Protect Liberty City From Criminals.", 5000, 1 );
else if ( pClass.ID == 2 )  SmallMessage( pClass,"Medic: Heal Citizens Of Liberty City.", 5000, 1 );
else if ( pClass.ID == 3 ) SmallMessage( pClass,"Bus Driver: Pick Up Citizens From Liberty City To Their Destination.", 5000, 1 );
else if ( pClass.ID == 4 ) SmallMessage( pClass,"Taxi Driver: Pick Up Citizens From Liberty City To Their Destination." 5000, 1 );
else SmallMessage( pClass,"Pick up Citizens from Liberty City to their destination", 5000, 1 );
return 1;
}

Here are the classes on Content.xml
Code: [Select]
<!-- Classes -->
<class team="1" skin="92" colour="0" x="P" y="P" z="20.35" angle="89.0043" sscreen="0"/> <!-- Police -->
<class team="2" skin="5" colour="3" x="P" y="-P" z="14.97" angle="88.3454" sscreen="0"/> <!-- Medic -->
<class team="3" skin="18" colour="7" x="P y="-P" z="14.89" angle="141.67" sscreen="0"/> <!-- Bus driver -->
<class team="3" skin="8" colour="6" x="P" y="-P" z="15.17" angle="305.907" sscreen="0"/> <!-- Taxi driver -->

<!-- Civilians -->

<class team="4" skin="9" colour="8" x="P" y="-P" z="1.83" angle="323.337" sscreen="0"/>
<class team="4" skin="18" colour="8" x="P" y="-1P" z="1.83" angle="323.337" sscreen="0"/>
<class team="4" skin="25" colour="8" x="P" y="-1P" z="1.83" angle="323.337" sscreen="0"/>
<class team="4" skin="30" colour="8" x="P" y="-1P" z="1.83" angle="323.337" sscreen="0"/>
<class team="4" skin="31" colour="8" x="P" y="-1P" z="1.83" angle="323.337" sscreen="0"/>
<class team="4" skin="32" colour="8" x="P" y="-1P" z="1.83" angle="323.337" sscreen="0"/>
<class team="4" skin="33" colour="8" x="P" y="-1P" z="1.83" angle="323.337" sscreen="0"/>
<class team="4" skin="34" colour="8" x="P" y="-1P" z="6.6" angle="53.8911" sscreen="0"/>
<class team="4" skin="35" colour="8" x="P" y="-P" z="6.6" angle="53.8911" sscreen="0"/>

X and Y Censored hehe
Title: Re: Help
Post by: Thijn on March 08, 2012, 02:12:53 pm
Ah now I see.
Replace your client.nut with this:
Code: [Select]
pPlayer <- FindLocalPlayer();

function onClientRequestClass( pClass )
{
if ( pClass.ID == 0 ) SmallMessage( "Cop: Protect Liberty City From Criminals.", 5000, 1 );
else if ( pClass.ID == 2 )  SmallMessage( "Medic: Heal Citizens Of Liberty City.", 5000, 1 );
else if ( pClass.ID == 3 ) SmallMessage( "Bus Driver: Pick Up Citizens From Liberty City To Their Destination.", 5000, 1 );
else if ( pClass.ID == 4 ) SmallMessage( "Taxi Driver: Pick Up Citizens From Liberty City To Their Destination." 5000, 1 );
else SmallMessage( "Pick up Citizens from Liberty City to their destination", 5000, 1 );
return 1;
}
Title: Re: Help
Post by: Rifle168 on March 08, 2012, 03:13:43 pm
Ah now I see.
Replace your client.nut with this:
Code: [Select]
pPlayer <- FindLocalPlayer();

function onClientRequestClass( pClass )
{
if ( pClass.ID == 0 ) SmallMessage( "Cop: Protect Liberty City From Criminals.", 5000, 1 );
else if ( pClass.ID == 2 )  SmallMessage( "Medic: Heal Citizens Of Liberty City.", 5000, 1 );
else if ( pClass.ID == 3 ) SmallMessage( "Bus Driver: Pick Up Citizens From Liberty City To Their Destination.", 5000, 1 );
else if ( pClass.ID == 4 ) SmallMessage( "Taxi Driver: Pick Up Citizens From Liberty City To Their Destination." 5000, 1 );
else SmallMessage( "Pick up Citizens from Liberty City to their destination", 5000, 1 );
return 1;
}

Oh thanks alot :) so client side functions doesn't require 'player'?
Title: Re: Help
Post by: Thijn on March 08, 2012, 08:04:12 pm
Nope :)
Title: Re: Help
Post by: SugarD on March 09, 2012, 03:51:51 am
Code: [Select]
<script file="main.nut" client="0" />
<script file="client.nut" client="1"/>

Shouldn't it be:

<script file="main.nut" client="0" />
<script file="client.nut" client="1" />
With the space there?
Title: Re: Help
Post by: Thijn on March 11, 2012, 10:40:40 am
Code: [Select]
<script file="main.nut" client="0" />
<script file="client.nut" client="1"/>

Shouldn't it be:

<script file="main.nut" client="0" />
<script file="client.nut" client="1" />
With the space there?
Don't think that makes much difference. As long as the tags are all closed.
Title: Re: Help
Post by: SugarD on March 11, 2012, 06:23:16 pm
Code: [Select]
<script file="main.nut" client="0" />
<script file="client.nut" client="1"/>

Shouldn't it be:

<script file="main.nut" client="0" />
<script file="client.nut" client="1" />
With the space there?
Don't think that makes much difference. As long as the tags are all closed.
Wouldn't the missing space bug that, though, since it's a self-closing tag?