Raised This Month: $ Target: $400
 0% 

Simple error i guess


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Cronck
Member
Join Date: Apr 2005
Old 04-23-2005 , 20:22   Simple error i guess
Reply With Quote #1

When i client joins the game a timer should started for the specific player and run the function CreateStatus(id) every ½ second to make sure their xp info is 'up-2-date'.

How do i fix this?
Code:
public client_connect(id) {  set_task(0.5,CreateStatusText,id,_,_,"b") }

Edit:
I've also tried this code:
Code:
public client_connect(id) {      new sid[22]      num_to_str(id,sid,21)      set_task(0.5,"CreateStatusText",id,sid,21,"b") }
Cronck is offline
teame06
i have a hat
Join Date: Feb 2005
Location: Hat City
Old 04-23-2005 , 20:45  
Reply With Quote #2

remove_task to stop a task.
__________________
No private support via Instant Message
GunGame:SM Released
teame06 is offline
Send a message via AIM to teame06
Cronck
Member
Join Date: Apr 2005
Old 04-23-2005 , 21:21  
Reply With Quote #3

Ok, thanks...

But how do i make my task start correctly?
Cronck is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 04-23-2005 , 21:29  
Reply With Quote #4

It depends what you're trying to do.
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
BioHazardousWaste
Senior Member
Join Date: Apr 2005
Location: Ontario, Canada =)
Old 04-23-2005 , 21:40  
Reply With Quote #5

I had this problem too.. the problem is that the steamid is not authorized (so you don't know it) yet. So what I did was put all that code on round start like this.

Code:
public client_connect(id) {     SetUpUser(id) } public SetUpUser(id) {     PlayerAlliance[id] = 0     PlayerExp[id] = 0     ReadyToLoad[id] = 1 }

then this is executed at the beginning of every round

Code:
        for(new i=1;i<=32;i++)         {                         if(ReadyToLoad[i] == 1)             {                 ReadyToLoad[i] = 0                 SetUpNewUser(i)                          }                  }
Where SetUpNewUser is loading exp and such. Hope that helps, also I had to set a 0.3 second delay (set_task) to allow everyone time to spawn.
__________________
"What then is truth? Truths are illusions which we have forgotten are illusions - they are metaphors that have become worn out... this (truth) is the duty to lie according to a fixed convention.

-Friedrich Nietzsche
BioHazardousWaste is offline
Send a message via MSN to BioHazardousWaste
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 04-23-2005 , 21:44  
Reply With Quote #6

I believe client_connect is deprecated, you should be using client_authorized(id) instead.. plus, the users steam id will have been auth'd by then, and you can use it..
I hope that helps..
xeroblood is offline
Send a message via MSN to xeroblood
Cronck
Member
Join Date: Apr 2005
Old 04-23-2005 , 22:02  
Reply With Quote #7

Players on the server are given an Id (1-32)
Thats the id i use to store xp and such things in....

When the client connects to the server, it should start a task
that runs CreateStatusText(id) with the users id every ½ second...

No matter what i do, it wont work...
Cronck is offline
BioHazardousWaste
Senior Member
Join Date: Apr 2005
Location: Ontario, Canada =)
Old 04-23-2005 , 22:04  
Reply With Quote #8

Holy christ, don't do that or esle you will be playing for liek 3 weeks as id #3 then i will connect the next day s the third player (id #3) and get all your experience!!!! As for it not working, I dunno try xerobloods method, it's more politically correct, but mine works for me.
__________________
"What then is truth? Truths are illusions which we have forgotten are illusions - they are metaphors that have become worn out... this (truth) is the duty to lie according to a fixed convention.

-Friedrich Nietzsche
BioHazardousWaste is offline
Send a message via MSN to BioHazardousWaste
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 04-23-2005 , 22:21  
Reply With Quote #9

Quote:
Originally Posted by Cronck
Players on the server are given an Id (1-32)
Thats the id i use to store xp and such things in....
I agree, bad idea.. use SteamID instead, it is the only truely unique ID for players to work with..

Quote:
Originally Posted by Cronck
When the client connects to the server, it should start a task
that runs CreateStatusText(id) with the users id every ½ second...
I smell lag!! Possibility of 32 functions running every 1/2 a second?!?!?! My advice: Show it to users only when the contents change!!
xeroblood is offline
Send a message via MSN to xeroblood
Cronck
Member
Join Date: Apr 2005
Old 04-23-2005 , 22:33  
Reply With Quote #10

XP Will not be saved...
And its reset every single time a client connects too (for the client only)

I guess i will just put it into my Damage event then...
Cronck is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:54.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode