AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   personal profiles on a server? (https://forums.alliedmods.net/showthread.php?t=22582)

Candy Man 12-30-2005 15:29

personal profiles on a server?
 
I'm not making a mod, just a fun menu(which I have). But I want it set it up so that the user gets stuff back at the begining of a new round if he buys the "badge" version rather than loose it at the begining of a new round. I did this using custom CVARs, but this changes it for everyone...

how do I get it so that if player "a" buys the badge version only he starts out with the item next new round... not any other player unless they have also bought the badge.. Like in warcraft how they have seperate XPs somehow...

slmclarengt 12-30-2005 16:38

It is usually best to use arrays in order to accomplish this. Then you would tell the plugin to give the person with the badge the item but nobody else.
Seeing that I have a poor attention span, i will explain it rather than code it.
You will need an array that will store the players id (userid, steamid, etc...) (one of those). Then, you will need a for loop to check all of the indices and an if statement in the for loop to see if they have the badge. If they do, continue giving item, if they do not, go to the next index.

Candy Man 12-30-2005 16:43

Uh, actually how would you do that? Would you put the player's id in an array? Then give the item to the id? How would you make the plugin know that it wasn't overwriting another id?
[Edit] Oh I think I got it:
Code:
// this would happen if player bouth the badge new array[20] new count = 0 array[count] = id ++count //so next user who uses it will be in slot #1
ok, now how would I get this array to my other function which is triggered by a new round? I need another function because this one is trggered by a menu and I want to give the items to the user without the user doing anything.


All times are GMT -4. The time now is 16:08.

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