AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   When does id change (https://forums.alliedmods.net/showthread.php?t=147426)

Len 01-09-2011 07:25

When does id change
 
player leaves, all id change?
player rejoins, all id change?
map change?
more people join?

I'm not sure and I need to store specific infomation about a player like if I've already spawned him or what his steamID is so I know if he has reconnected within a specific time.

currently doing something like this:
player[id] = steamid
player.[steamid][34] = id
player.team[id] = team
player.spawn[id] = 1/0

Len 01-09-2011 13:23

Re: When does id change
 
argh... no reply yet many views like all my other posts, I can't test no server to test on.. if you can't understand what I'm asking say so..

Arkshine 01-09-2011 13:29

Re: When does id change
 
People are not machines. Be patient and also read the rules, don't bump until 15 days have passed from the previous message. Thanks.

fysiks 01-09-2011 13:30

Re: When does id change
 
It's only been 6 hours, you need to be patient. I just woke up.

Quote:

Originally Posted by Len (Post 1389662)
player leaves, all id change?
player rejoins, all id change?
map change?
more people join?

It really depends on which id you are refering to.

1. SteamID. Always the same for each Steam account.
2. UserID (get_user_userid()). You get a new one every time you connect (for the first time) to a server. This on is the same after a map change.
3. Entity Index (usually denoted by "id" in plugins). Is a number from 1 to 32 that tells you what entity the player is on the map. The first person to join the server gets 1. The second get 2 (if the first has not left). If 5 people have joined and the third person leaves then the next person to join will get 3. This one is not guaranteed to be the same after a mapchange.

Len 01-09-2011 13:48

Re: When does id change
 
Arkshine I don't fancy waiting 15 days for a answer
the rules need fixing, so that only applys to spammers and suggestions/requests obviously if you have to wait 15 days for a question to be answered what's the point as I'm learning and likely to be asking ALOT of questions along the road.

But yes fysiks thank you very much, I guess I'll have to save my questions for 18:45, when fysiks wakes up in USA to get a answer or something other then
"Don't BUMP before 360 hours of debugging and going through poor documentation. -> RULES"

Fysiks yes it's id in functions I'm referring to, so it does change every time someone leaves and a new player joins? I'm going to try and do something like this, but I can't find anything telling me how:

/*
player[id] = steamid
player.[steamid][0] = id
player.[steamid][1] = team
player.[steamid][2] = spawn
*/
problem's im facing is how do I save a var with name player.'there steamid'
PHP Code:

    new id get_data(1), auth
    get_user_authid
(idauth34)
    new 
player.[auth][3]
        if (
task_exists(player[player.[auth][0]]))
    {
        
remove_task(player[player.[auth][0]])
        
player[player.[auth][0]] = ""player[id] = authplayer.[auth] = id
        m_player_team
(idplayer.[auth][1])
    } 

that is how im trying to do it, the task is set when they leave

fysiks 01-09-2011 14:10

Re: When does id change
 
It looks like you are trying to do a C++ thing with the . in your variables, you can't do that in this language. Also, you cannot index an array with a string (works in PHP but not here).

In game you have to reference people by their entity index. If you wanting to save or retrieve something to or from a file or sql then you get their SteamID then. It's done this way in every plugin.

Arkshine 01-09-2011 14:13

Re: When does id change
 
Quote:

Arkshine I don't fancy waiting 15 days for a answer
the rules need fixing, so that only applys to spammers and suggestions/requests obviously if you have to wait 15 days for a question to be answered what's the point as I'm learning and likely to be asking ALOT of questions along the road.
I don't care if you don't want to wait. It's the rules. You have to respect them. The way you say, you consider the people as your slaves. Just because you have views doesn't mean someone should have answered. If you get no answers it means nobody know at this time. Just because you want help doesn't allow you to complain because the help is not as fast as you would want. People are willing to help for free and on their free time, it would be nice to avoid saying such bullshits. If you have time for that, search and think more. Hope it's clear.

Len 01-09-2011 14:15

Re: When does id change
 
fysiks, the plugin im trying to create, is so players can join and spawn if the round is X% of round time into the round, X is set by a amx_cvar I made - but to prevent them reconnecting and spawning again, I need to save something in reference to them, so it has to be there steamid, an I need to save the team they were previously in after reconnecting so I can force them to join that again.


no I don't, I read what I said and I didn't mean fysiks waking up at bla time to help me in the way it came accross which was in a slave do now way.. I see what you're saying about views and I agree but the time for support isn't very good.. for me especially I appreciate what you're saying though, but Arkshine I highly doubt you didn't know the answer

fysiks 01-09-2011 14:19

Re: When does id change
 
Quote:

Originally Posted by Len (Post 1389956)
fysiks, the plugin im trying to create, is so players can join and spawn if the round is X% of round time into the round, X is set by a amx_cvar I made - but to prevent them reconnecting and spawning again, I need to save something in reference to them, so it has to be there steamid, an I need to save the team they were previously in after reconnecting so I can force them to join that again.

You can save their SteamID to a Trie with SteamID as the key and their team as the value. Then when someone connect, check if they are in the trie. If they are then set their team to the one saved in the Trie.

Len 01-09-2011 14:31

Re: When does id change
 
fysiks I also need to know if I have spawned them, so should I just put the value as team - 1/0


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

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