Liberty Unleashed
Scripting => Script Help => Topic started by: Rifle168 on March 06, 2012, 04:09:09 pm
-
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;
}
<script file="client.nut" client="1"/>It doesn't work or even executive.
-
try something like this:
--
His code is fine.
Are you sure you're loading the script in your Content.xml file?
-
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 :(
-
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?
-
Server Folder>Lu > Content.xml
<script folder="Main" />
Server Folder>Scripts>Main> Script.xml
<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
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
<!-- 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
-
Ah now I see.
Replace your client.nut with this:
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;
}
-
Ah now I see.
Replace your client.nut with this:
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'?
-
Nope :)
-
<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?
-
<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.
-
<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?