Author Topic: (new problem) Save and Load (server sided)  (Read 1247 times)

Hey anyone have a idea how to make for example  adding  clan tag to the client with the  FindClientByName(%name).clanSuffix and save it when they leave and load it automatic when they join.

And the way to remove it again.

Anyone?

 :cookie:
« Last Edit: September 07, 2011, 06:55:42 PM by xcruso »

Well idk the full code but you could try making a script add a variable when the player joins and stuff...
And when the player joins again the variable will be searched and found and executed and stuff....
To remove all you do is remove the variable lolz.

Code: [Select]
function changeclantag(%client,%target,%clantag)
{
if(%client.isAdmin || %client.isSuperAdmin)
{
%target = findclientbyname(%target);
if(isObject(%target))
{
%target.clanprefix = %clantag;
$clantags[%target.bl_id] = %clantag;
export("$clantags*","config/server/clantags.cs");
}
else
messageclient(%client,'',"\c6No user was found by that name.");
}
else
messageclient(%client,'',"\c6You must be admin to change other people's clan tags.");
}
That's your changing function code.
Code: [Select]
package clantagchanger
{
function GameConnection::AutoAdminCheck(%client)
{
Parent::AutoAdminCheck(%client);
if(strlen($clantags[%client.bl_id]) > 0)
%client.clanprefix = $clantags[%client.bl_id];
}
};
activatepackage(clantagchanger);
And that changes people tags to what you set when they join.



I just typed this up now.
Have no idea if it works.
And sorry for the lack of indentation, these forums won't let me do it.
« Last Edit: September 05, 2011, 02:38:03 PM by DrenDran »

Code: [Select]
function changeclantag(%client,%target,%clantag)
{
if(%client.isAdmin || %client.isSuperAdmin)
{
%target = findclientbyname(%target);
if(isObject(%target))
{
%target.clanprefix = %clantag;
$clantags[%target.bl_id] = %clantag;
export("$clantags*","config/server/clantags.cs");
}
else
messageclient(%client,'',"\c6No user was found by that name.");
}
else
messageclient(%client,'',"\c6You must be admin to change other people's clan tags.");
}
That's your changing function code.
Code: [Select]
package clantagchanger
{
function GameConnection::AutoAdminCheck(%client)
{
Parent::AutoAdminCheck(%client);
if(strlen($clantags[%client.bl_id]) > 0)
%client.clanprefix = $clantags[%client.bl_id];
}
};
activatepackage(clantagchanger);
And that changes people tags to what you set when they join.



I just typed this up now.
Have no idea if it works.
And sorry for the lack of indentation, these forums won't let me do it.

Thanks, havent tested yet busy with other things.

Ok, i got a new Problem, the clan tag is getting removed after restarting the game, any idea to fix that?

add:
Code: [Select]
exec("config/server/clantags.cs");

to the END of your script.  Then it will load whatever is saved when you rsestart.

add:
Code: [Select]
exec("config/server/clantags.cs");

to the END of your script.  Then it will load whatever is saved when you rsestart.

Thanks.

Edit: The one DrenDran gave me i made it into a /command but it writes $clantags12397 = "Test"; but that one doesn't work as loading it again  I would like to make it say  $clantags12397 = FindClientByName(%target).clanPrefix = "Test";
Please tell me if there is any way to make it write that in the clantags
:D 
« Last Edit: September 09, 2011, 05:23:19 AM by xcruso »