Author Topic: Need help with class name and class weapon spawn  (Read 6706 times)

xxxMDjxxx

  • Jr. Member
  • **
  • Posts: 54
  • Karma: +0/-0
  • SS-division*game hosting
    • View Profile
Need help with class name and class weapon spawn
« on: March 17, 2011, 10:20:57 pm »
Well, i found some code on the forum and wiki, but it does not work for me, probably something wrong...

I tried to make, when you select a character you spawn and see the class name...
Actualy its the same two things as someone asked here ->http://forum.liberty-unleashed.co.uk/index.php?topic=531.0  but it still doesent work for me... Or i dont know how to use it correctly.

And i tried to make each class get weapons when spawning or when die and respawn... but nothing..
Im just new to this code so please help me, im more good with html or php...

Sorry for my poor english, im Slovene ::)

Thijn

  • Tester
  • Sr. Member
  • ****
  • Posts: 531
  • Karma: +27/-16
    • View Profile
Re: Need help with class name and class weapon spawn
« Reply #1 on: March 17, 2011, 11:09:23 pm »
Please post your code you have so far so we can correct you and tell you what's wrong ;)

xxxMDjxxx

  • Jr. Member
  • **
  • Posts: 54
  • Karma: +0/-0
  • SS-division*game hosting
    • View Profile
Re: Need help with class name and class weapon spawn
« Reply #2 on: March 18, 2011, 12:01:05 am »
I pasted this in main.nut file:

Code: [Select]
function onClientRequestClass( player, classid )
   {
   if(class.ID == 0)
    {
    BigMessage("Mafia",5000,1);
    }
    if(class.ID == 1)
    {
    BigMessage("Police",5000,1);
    }
    return 1;
}

and this in content.xml
Code: [Select]
<weapon class=”0” model=”2” ammo=”250” />
<weapon class=”1” model=”2” ammo=”250” />

and neather of them work... i must of made something wrong... is the "weapon class" the comand which class gets the weapon... and did i paste the codes to correct files... the class selections and skins i made are ok but this is giving me problems...

thanks for replying...

Nexus

  • Newbie
  • *
  • Posts: 45
  • Karma: +3/-0
    • View Profile
Re: Need help with class name and class weapon spawn
« Reply #3 on: March 18, 2011, 08:14:20 am »
lol this is my spawn selection screen :) well you need know the gui functions to do that http://liberty-unleashed.co.uk/LUWiki/Squirrel/Client/Functions#GUI_Functions, and i am not using the class thingy, use the team.id, look this small part of my script :)
Code: [Select]
function onClientRequestClass( plrclass )
{
    if ( !Team.Visible ) Team.Visible = true;
local team = plrclass.Team;
if ( team == 1 )
{
Team.Text = "Mafia";
local SpawnPos = RandSpawns[ team - 1 ][ 0 ]; //--- replace it to localplr.SpawnPos :)
if ( SpawnPos )
{
   lP.Pos = Vector( SpawnPos.x, SpawnPos.y, SpawnPos.z + 1 );
   SetCameraMatrix( Vector( SpawnPos.x, SpawnPos.y + 5, SpawnPos.z + 1 ), SpawnPos );
}
}


and my skin is "<class team="1" skin="107" colour="2" x="1000.10" y="-885.20" z="15.34" angle="0.0" sscreen="0"/>" the number 1 is the mafia gang well good luck :)



<X_94> messi suckz!!
<~Baldachyn> yes x94 finally some sane words from you

xxxMDjxxx

  • Jr. Member
  • **
  • Posts: 54
  • Karma: +0/-0
  • SS-division*game hosting
    • View Profile
Re: Need help with class name and class weapon spawn
« Reply #4 on: March 18, 2011, 09:13:07 am »
Im sorry, but still no effect... nothing changes...
Im using this for selecting the mafia (Luigi skin, spawning at Leones house) this is in content.xml and works OKay.
Code: [Select]
<class team="1" skin="107" colour="1" x="1460.6" y="-178.37" z="55.77" angle="123.048" sscreen="0"/>
I pasted your code to Main.nut (probbably wrong file right...)
Code: [Select]
function onClientRequestClass( plrclass )
{
    if ( !Team.Visible ) Team.Visible = true;
local team = plrclass.Team;
if ( team == 1 )
{
Team.Text = "Mafia";
local SpawnPos = RandSpawns[ team - 1 ][ 0 ]; //--- replace it to localplr.SpawnPos :)
if ( SpawnPos )
{
   lP.Pos = Vector( SpawnPos.x, SpawnPos.y, SpawnPos.z + 1 );
   SetCameraMatrix( Vector( SpawnPos.x, SpawnPos.y + 5, SpawnPos.z + 1 ), SpawnPos );
}
}
}

idk, im sure its my fault, or im looking for the wrong thing, i was trying to make a text announcement when you spawn as luigi (or class 1) at the house, you se text MAFIA for a few seconds.

Still having no luck with geting weapons at spawning, or if somebody could atleast help me make a weapon pickup that reapears every 5 seconds...

I hope im not bugging you :p and this is not coding requesting, i yust think i learn faster if someone shows me the code... thats how i learned php and html etc...

----------EDIT-----------------

Wel now i discovered that the weapons at spawning work, but only for one character :S if i spawn as 8-ball i have the weapons when i spawn, if i spawn as any other charracter of any class, i dont have weapons...
the code i use for character spawning is:
Code: [Select]
<class team="1" skin="84" colour="1" x="1460.6" y="-178.37" z="55.77" angle="123.048" sscreen="0"/>
<class team="1" skin="97" colour="1" x="1460.6" y="-178.37" z="55.77" angle="123.048" sscreen="0"/>
<class team="1" skin="98" colour="1" x="1460.6" y="-178.37" z="55.77" angle="123.048" sscreen="0"/>
<class team="1" skin="99" colour="1" x="1460.6" y="-178.37" z="55.77" angle="123.048" sscreen="0"/>
<class team="1" skin="101" colour="1" x="1460.6" y="-178.37" z="55.77" angle="123.048" sscreen="0"/>
<class team="1" skin="103" colour="1" x="1460.6" y="-178.37" z="55.77" angle="123.048" sscreen="0"/>
<class team="1" skin="107" colour="1" x="1460.6" y="-178.37" z="55.77" angle="123.048" sscreen="0"/>
<class team="1" skin="109" colour="1" x="1460.6" y="-178.37" z="55.77" angle="123.048" sscreen="0"/>
<class team="1" skin="108" colour="1" x="1460.6" y="-178.37" z="55.77" angle="123.048" sscreen="0"/>
<class team="1" skin="115" colour="1" x="1460.6" y="-178.37" z="55.77" angle="123.048" sscreen="0"/>
<class team="2" skin="1" colour="2" x="1168.4" y="-666.1" z="18.89" angle="349.276" sscreen="0"/>
<class team="2" skin="2" colour="2" x="1168.4" y="-666.1" z="18.89" angle="349.276" sscreen="0"/>
<class team="2" skin="3" colour="2" x="1168.4" y="-666.1" z="18.89" angle="349.276" sscreen="0"/>
<class team="2" skin="4" colour="2" x="1168.4" y="-666.1" z="18.89" angle="349.276" sscreen="0"/>
<class team="2" skin="88" colour="2" x="1168.4" y="-666.1" z="18.89" angle="349.276" sscreen="0"/>
<class team="2" skin="89" colour="2" x="1168.4" y="-666.1" z="18.89" angle="349.276" sscreen="0"/>
<class team="2" skin="92" colour="2" x="1168.4" y="-666.1" z="18.89" angle="349.276" sscreen="0"/>
<class team="2" skin="94" colour="2" x="1168.4" y="-666.1" z="18.89" angle="349.276" sscreen="0"/>
<class team="2" skin="121" colour="2" x="1168.4" y="-666.1" z="18.89" angle="349.276" sscreen="0"/>
<class team="3" skin="12" colour="3" x="980.4" y="-696.6" z="14.97" angle="174.301" sscreen="0"/>
<class team="3" skin="13" colour="3" x="980.4" y="-696.6" z="14.97" angle="174.301" sscreen="0"/>
<class team="3" skin="16" colour="3" x="980.4" y="-696.6" z="14.97" angle="174.301" sscreen="0"/>
<class team="3" skin="17" colour="3" x="980.4" y="-696.6" z="14.97" angle="174.301" sscreen="0"/>
<class team="3" skin="43" colour="3" x="980.4" y="-696.6" z="14.97" angle="174.301" sscreen="0"/>
<class team="3" skin="47" colour="3" x="980.4" y="-696.6" z="14.97" angle="174.301" sscreen="0"/>
<class team="3" skin="85" colour="3" x="980.4" y="-696.6" z="14.97" angle="174.301" sscreen="0"/>
<class team="3" skin="87" colour="3" x="980.4" y="-696.6" z="14.97" angle="174.301" sscreen="0"/>
<class team="4" skin="9" colour="4" x="1271.3" y="-1107.4" z="12.13" angle="277.641" sscreen="0"/>
<class team="4" skin="14" colour="4" x="1271.3" y="-1107.4" z="12.13" angle="277.641" sscreen="0"/>
<class team="4" skin="15" colour="4" x="1271.3" y="-1107.4" z="12.13" angle="277.641" sscreen="0"/>
<class team="4" skin="22" colour="4" x="1271.3" y="-1107.4" z="12.13" angle="277.641" sscreen="0"/>
<class team="4" skin="23" colour="4" x="1271.3" y="-1107.4" z="12.13" angle="277.641" sscreen="0"/>
<class team="4" skin="24" colour="4" x="1271.3" y="-1107.4" z="12.13" angle="277.641" sscreen="0"/>
<class team="4" skin="25" colour="4" x="1271.3" y="-1107.4" z="12.13" angle="277.641" sscreen="0"/>
<class team="4" skin="37" colour="4" x="1271.3" y="-1107.4" z="12.13" angle="277.641" sscreen="0"/>
<class team="4" skin="38" colour="4" x="1271.3" y="-1107.4" z="12.13" angle="277.641" sscreen="0"/>
<class team="4" skin="40" colour="4" x="1271.3" y="-1107.4" z="12.13" angle="277.641" sscreen="0"/>
<class team="4" skin="42" colour="4" x="1271.3" y="-1107.4" z="12.13" angle="277.641" sscreen="0"/>
<class team="5" skin="55" colour="5" x="1163.9" y="-7.47" z="1.67" angle="358.292" sscreen="0"/>
<class team="5" skin="56" colour="5" x="1163.9" y="-7.47" z="1.67" angle="358.292" sscreen="0"/>
<class team="5" skin="18" colour="5" x="1163.9" y="-7.47" z="1.67" angle="358.292" sscreen="0"/>
<class team="5" skin="19" colour="5" x="1163.9" y="-7.47" z="1.67" angle="358.292" sscreen="0"/>
<class team="5" skin="48" colour="5" x="1163.9" y="-7.47" z="1.67" angle="358.292" sscreen="0"/>
<class team="5" skin="51" colour="5" x="1163.9" y="-7.47" z="1.67" angle="358.292" sscreen="0"/>
<class team="5" skin="77" colour="5" x="1163.9" y="-7.47" z="1.67" angle="358.292" sscreen="0"/>
<class team="5" skin="79" colour="5" x="1163.9" y="-7.47" z="1.67" angle="358.292" sscreen="0"/>
<class team="5" skin="80" colour="5" x="1163.9" y="-7.47" z="1.67" angle="358.292" sscreen="0"/>
<class team="5" skin="120" colour="5" x="1163.9" y="-7.47" z="1.67" angle="358.292" sscreen="0"/>

I have 5 classes :
1=mafia
2=police
3=triads
4=diablos
5=bums

the weapons code i use is
Code: [Select]
<weapon class="1" model="6" ammo="50"/>
<weapon class="1" model="2" ammo="50"/>
<weapon class="1" model="1" ammo="1"/>
<weapon class="1" model="11" ammo="50"/>
<weapon class="2" model="3" ammo="50"/>
<weapon class="2" model="2" ammo="50"/>
<weapon class="2" model="1" ammo="1"/>
<weapon class="2" model="11" ammo="50"/>
<weapon class="3" model="5" ammo="50"/>
<weapon class="3" model="2" ammo="50"/>
<weapon class="3" model="1" ammo="1"/>
<weapon class="3" model="11" ammo="50"/>
<weapon class="4" model="5" ammo="50"/>
<weapon class="4" model="2" ammo="50"/>
<weapon class="4" model="1" ammo="1"/>
<weapon class="4" model="11" ammo="50"/>
<weapon class="5" model="5" ammo="50"/>
<weapon class="5" model="2" ammo="50"/>
<weapon class="5" model="1" ammo="1"/>
<weapon class="5" model="11" ammo="50"/>

That means every team gets a rifle, bat, pistol and granades...
This code didnot work til i tryed it today, but suddenly it works... but only with 8-ball

You can try to connect to my server:
Name: Anticefur uradni server
Ip: 93.103.34.187:5001
Password: burek

« Last Edit: March 18, 2011, 10:54:26 am by xxxMDjxxx »

VRocker

  • Liberty Unleashed Developer
  • Administrator
  • Full Member
  • ******
  • Posts: 342
  • Karma: +43/-15
    • View Profile
    • Madnight Software
Re: Need help with class name and class weapon spawn
« Reply #5 on: March 18, 2011, 12:30:20 pm »
Dont know why the weapons arnt working, but i know why your script isnt.

As the function name suggests, it is a Client script. Your putting it in a server script.
Just make a new script file, put the code in it then add it to your script.xml and set the client argument to 1

With pickups, you can create them in your content.xml or via the script. If you just want weapon pickups and want them all to respawn with the same delay, put them in your content and set the pickup_respawn_time in the server.conf. If you want differant delays you can do it via script. The wiki will help you.


xxxMDjxxx

  • Jr. Member
  • **
  • Posts: 54
  • Karma: +0/-0
  • SS-division*game hosting
    • View Profile
Re: Need help with class name and class weapon spawn
« Reply #6 on: March 18, 2011, 03:45:46 pm »
Hej, thanks for your reply, im,currently in Ljubljana surfing my phone.
Ill try it when i get home and write back if i get it right.
 ;D

Juppi

  • Developer
  • Jr. Member
  • *****
  • Posts: 86
  • Karma: +3/-1
    • View Profile
    • Kuslahden alaste GTA:MP clan
Re: Need help with class name and class weapon spawn
« Reply #7 on: March 18, 2011, 06:20:37 pm »
A few notes: In your original script you're using 'class' as a variable name. 'class' is a keyword in squirrel so it can't be used for variables, instead you could use something like 'spawnclass' and do spawnclass.ID etc.

Another note is the content.xml syntax. You can simplify the weapon listings: for example, instead of doing

Code: [Select]
<weapon class="1" model="2" ammo="50"/>
<weapon class="2" model="2" ammo="50"/>
<weapon class="3" model="2" ammo="50"/>
<weapon class="4" model="2" ammo="50"/>
<weapon class="5" model="2" ammo="50"/>

you can simply do

Code: [Select]
<weapon class="1-5" model="2" ammo="50"/>
or if, for example, you want to give everyone else but class 3 a pistol you can do

Code: [Select]
<weapon class="1-2,4-5" model="2" ammo="50"/>

Nexus

  • Newbie
  • *
  • Posts: 45
  • Karma: +3/-0
    • View Profile
Re: Need help with class name and class weapon spawn
« Reply #8 on: March 18, 2011, 06:24:48 pm »
it is a Client script.


i forgot it, ty :)

well you need know the gui functions to do that http://liberty-unleashed.co.uk/LUWiki/Squirrel/Client/Functions#GUI_Functions


^^-------- remember that :), u can see some scripts like, the juppi's speedo, or his freeview script to learn how to use labels and images in the client script.



<X_94> messi suckz!!
<~Baldachyn> yes x94 finally some sane words from you

xxxMDjxxx

  • Jr. Member
  • **
  • Posts: 54
  • Karma: +0/-0
  • SS-division*game hosting
    • View Profile
Re: Need help with class name and class weapon spawn
« Reply #9 on: March 19, 2011, 09:43:17 am »
Dont know why the weapons arnt working, but i know why your script isnt.

As the function name suggests, it is a Client script. Your putting it in a server script.
Just make a new script file, put the code in it then add it to your script.xml and set the client argument to 1

With pickups, you can create them in your content.xml or via the script. If you just want weapon pickups and want them all to respawn with the same delay, put them in your content and set the pickup_respawn_time in the server.conf. If you want differant delays you can do it via script. The wiki will help you.

Thanks for the reply!
I tried what you written about the script:
i created "scripts/names" folder in it i created "script.xml" with  code <script file="main.nut" client=1>(this texy might not be correct here because i wrote what i remember its not copyed :p)
and in the same folder i created main.nut with:
Code: [Select]
function onClientRequestClass( plrclass )
{
    if ( !Team.Visible ) Team.Visible = true;
local team = plrclass.Team;
if ( team == 1 )
{
Team.Text = "Mafia";
local SpawnPos = RandSpawns[ team - 1 ][ 0 ]; //--- replace it to localplr.SpawnPos :)
if ( SpawnPos )
{
    lP.Pos = Vector( SpawnPos.x, SpawnPos.y, SpawnPos.z + 1 );
    SetCameraMatrix( Vector( SpawnPos.x, SpawnPos.y + 5, SpawnPos.z + 1 ), SpawnPos );
}
}
if ( team == 2 )
{
Team.Text = "Police";
local SpawnPos = RandSpawns[ team - 2 ][ 0 ]; //--- replace it to localplr.SpawnPos :)
if ( SpawnPos )
{
    lP.Pos = Vector( SpawnPos.x, SpawnPos.y, SpawnPos.z + 1 );
    SetCameraMatrix( Vector( SpawnPos.x, SpawnPos.y + 5, SpawnPos.z + 1 ), SpawnPos );
}
}
}

And.... no luck with that....

For the weapons: i wrote my code as juppi wrote on the forum, so that code is much smaller now than before :p
But no luck, am i maby making a mistake in thinking that it doesent matter where you put the code in the content.xml???

any whay, if this code for weapons keeps bugging me ill yust make pickups at spawns and set them to respawn on 1second if picked up, do you think thats ok, and would it lagg the server?

Thijn

  • Tester
  • Sr. Member
  • ****
  • Posts: 531
  • Karma: +27/-16
    • View Profile
Re: Need help with class name and class weapon spawn
« Reply #10 on: March 19, 2011, 04:54:49 pm »
its client="1" (in your script.xml)

xxxMDjxxx

  • Jr. Member
  • **
  • Posts: 54
  • Karma: +0/-0
  • SS-division*game hosting
    • View Profile
Re: Need help with class name and class weapon spawn
« Reply #11 on: March 19, 2011, 09:37:37 pm »
its client="1" (in your script.xml)

As i wrote, that line on my post is not correct because i wrote what i remember, i didnot copy it from my server... anyway its not working...

my script.xml
http://plunder.com/9a9e611b9e
my ime.nut
http://plunder.com/b52ae4fa7d

i didnot paste the script here because i cannot copy text from my server, so i uploaded it and pasted the link.


Can please someone check them because its just too hard for me....

I am trying to have a script that sshows the team name when chosing models and you can see it for a few seconds after you chose a character, then it dissapears.

Thijn

  • Tester
  • Sr. Member
  • ****
  • Posts: 531
  • Karma: +27/-16
    • View Profile
Re: Need help with class name and class weapon spawn
« Reply #12 on: March 20, 2011, 10:11:26 am »
oh god, at least upload it to a normal upload site without fucking surveys that don't work...

xxxMDjxxx

  • Jr. Member
  • **
  • Posts: 54
  • Karma: +0/-0
  • SS-division*game hosting
    • View Profile
Re: Need help with class name and class weapon spawn
« Reply #13 on: March 20, 2011, 10:30:18 am »
oh god, at least upload it to a normal upload site without fucking surveys that don't work...

Sorry but, you must of clicked the wrong "Download Now!" link at the download site, the big green one is a "fake" link or advertisement link, below that you can se gray unclickable texy DOWNLOAD and below that "content.xml"(filename), and below that "download"

I was in a hurry so i just wrote text upload in google and this was the first link....
« Last Edit: March 20, 2011, 10:33:22 am by xxxMDjxxx »

Thijn

  • Tester
  • Sr. Member
  • ****
  • Posts: 531
  • Karma: +27/-16
    • View Profile
Re: Need help with class name and class weapon spawn
« Reply #14 on: March 20, 2011, 02:52:42 pm »

I don't see any download link, Do you?

Like I said, upload it to a normal uploading service like megaupload,rapidshare etc. etc.

 

© Liberty Unleashed Team.