Author Topic: Help  (Read 2806 times)

Rifle168

  • Newbie
  • *
  • Posts: 12
  • Karma: +2/-1
    • View Profile
Help
« on: March 06, 2012, 05: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.


Thijn

  • Tester
  • Sr. Member
  • ****
  • Posts: 531
  • Karma: +27/-16
    • View Profile
Re: Help
« Reply #1 on: March 06, 2012, 09: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?

Rifle168

  • Newbie
  • *
  • Posts: 12
  • Karma: +2/-1
    • View Profile
Re: Help
« Reply #2 on: March 07, 2012, 03: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 :(

Thijn

  • Tester
  • Sr. Member
  • ****
  • Posts: 531
  • Karma: +27/-16
    • View Profile
Re: Help
« Reply #3 on: March 07, 2012, 02: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?

Rifle168

  • Newbie
  • *
  • Posts: 12
  • Karma: +2/-1
    • View Profile
Re: Help
« Reply #4 on: March 08, 2012, 03: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

Thijn

  • Tester
  • Sr. Member
  • ****
  • Posts: 531
  • Karma: +27/-16
    • View Profile
Re: Help
« Reply #5 on: March 08, 2012, 03: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;
}

Rifle168

  • Newbie
  • *
  • Posts: 12
  • Karma: +2/-1
    • View Profile
Re: Help
« Reply #6 on: March 08, 2012, 04: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'?

Thijn

  • Tester
  • Sr. Member
  • ****
  • Posts: 531
  • Karma: +27/-16
    • View Profile
Re: Help
« Reply #7 on: March 08, 2012, 09:04:12 pm »
Nope :)

SugarD

  • Argonath RPG Dev/Manager
  • Tester
  • Sr. Member
  • ****
  • Posts: 820
  • Karma: +37/-75
  • STOP IN THE NAME OF THE COLESLAW!
    • View Profile
    • Clan Xperience
Re: Help
« Reply #8 on: March 09, 2012, 04: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?

Thijn

  • Tester
  • Sr. Member
  • ****
  • Posts: 531
  • Karma: +27/-16
    • View Profile
Re: Help
« Reply #9 on: March 11, 2012, 11: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.

SugarD

  • Argonath RPG Dev/Manager
  • Tester
  • Sr. Member
  • ****
  • Posts: 820
  • Karma: +37/-75
  • STOP IN THE NAME OF THE COLESLAW!
    • View Profile
    • Clan Xperience
Re: Help
« Reply #10 on: March 11, 2012, 07: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?

 

© Liberty Unleashed Team.