The online racing simulator
Set/GetCurrentUserVar
IS there any way that i can do Get(or set) Current user varibles

I came up with this:


<?php 
    
function SetPlayerVar($UCID$SetVar$Value)
    {
      
$PlayerVar[$UCID][$SetVar] = $Value;
    }
    function 
GetPlayerVar($UCID$GetVar)
    {
    Return(
$PlayerVar[$UCID][$GetVar]);
    }    
?>

but the problem is... there is some packets that don't have UCID
This will not work because u use 2 variables: $_Session and $PlayerVar so you have to choice which one are you going to use.

On-topic:
You can get UCID by additional function.
Use these functions, depending on the variable you have available.

All of these functions will return the player instance or NULL.

<?php 
Plugins
::getPlayerByPLID($PLID$hostAlias NULL)
Plugins::getPlayerByUCID($UCID$hostAlias NULL)
Plugins::getPlayerByPName($PName$hostAlias NULL)
Plugins::getPlayerByUName($UName$hostAlias NULL)
?>

All of these functions will return the client instance or NULL.

<?php 
Plugins
::getClientByPLID($PLID$hostAlias NULL);
Plugins::getClientByUCID($UCID$hostAlias NULL);
Plugins::getClientByPName($PName$hostAlias NULL);
Plugins::getClientByUName($UName$hostAlias NULL);
?>

You should use these methods to get information on your client. Any data that you need stored should be stored by your plugin, and not added to the state as it's unique to your plugin.
Quote from misiek08 :This will not work because u use 2 variables: $_Session and $PlayerVar so you have to choice which one are you going to use.

On-topic:
You can get UCID by additional function.

ye i ment to change back to $PlayerVar :P


Quote from Dygear :Any data that you need stored should be stored by your plugin

wait how do i do that?
Quote from Fire_optikz001 :wait how do i do that?

Make a variable within your plugin and store the user data there.


<?php 
php
class cruse extends Plugins
{
    const 
URL 'http://lfsforum.net/forumdisplay.php?f=312';
    const 
NAME 'Cruse Mod';
    const 
AUTHOR "Fire_optikz001";
    const 
VERSION '0.1.0';
    const 
DESCRIPTION 'Once started turns your server into a cruse sever.';

    private 
$clients = array();
    private 
$players = array();

    public function 
__construct()
    {
        
/* Startup Stuff */
    
}

    
/* Plugin Logic Stuff */
}
?>

Quote from Dygear :Make a variable within your plugin and store the user data there.


<?php 
php
class cruse extends Plugins
{
    const 
URL 'http://lfsforum.net/forumdisplay.php?f=312';
    const 
NAME 'Cruse Mod';
    const 
AUTHOR "Fire_optikz001";
    const 
VERSION '0.1.0';
    const 
DESCRIPTION 'Once started turns your server into a cruse sever.';

    private 
$clients = array();
    private 
$players = array();

    public function 
__construct()
    {
        
/* Startup Stuff */
    
}

    
/* Plugin Logic Stuff */
}
?>


oh right x]

so it would be set up like this?

<?php 
array("UserName/UCID" => array("Cash" => 100 ))
?>

or something like that
Quote from Fire_optikz001 :oh right x]

so it would be set up like this?

<?php 
array("UserName/UCID" => array("Cash" => 100 ))
?>

or something like that

For the client array, you should use their UCID.
For the players array, you should use their PLID.

You should also catch the events when a new client connects, (IS_NCN) and when they disconnect (IS_CNL). The same is said of players when they join (IS_NPL) and when they leave (IS_PLL) so that you can edit, and or remove them from there restrictive array within your plugin.
ok well now this comes to mind how do i add/edit/remove items from an array ... i have seen it done but i cant remember how
oh wow... (i already went through that before...) i already knew that stuff ... i must have been half asleep when i posted that

FGED GREDG RDFGDR GSFDG