SA-MP Forums Archive
Editing ALL registered users at once. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Editing ALL registered users at once. (/showthread.php?tid=332060)



Editing ALL registered users at once. - Deathh - 07.04.2012

How do i do that?

Can someone give me an example?

Here's an exmaple of my code.

For example, I want to set all players level to 0.

pawn Код:
new x = 0;
            while(x != MAX_PLAYERS)
            format(string, sizeof(string), "%s.ini",x);
                result[idx - offset] = EOS;
==================================
                dini_IntSet(string, "Level", 0);
How do I do it?
+rep for help.


Re: Editing ALL registered users at once. - [HiC]TheKiller - 07.04.2012

You cant really set every players level to 0 without them being online unless you had a list of all registered players in a file then you could edit all the different files. I would probably just set the players level to 0 when they connect, and have a variable set if they have had their level reset already. If the variable isn't set, then just make it so the players level is set to 0.


Re: Editing ALL registered users at once. - Deathh - 07.04.2012

I can't do that.

But yeah, all userfiles are saved as %s.cfg in one file ( scriptfiles ofc )

How would i do it mate?

I can't edit 6,500 accounts without cutting my **** off lol


Re: Editing ALL registered users at once. - [HiC]TheKiller - 07.04.2012

Just make a PHP / C# script / plugin that loops through the files and sets all the levels to 0. You cant really do this in PAWN though.


Re: Editing ALL registered users at once. - Deathh - 07.04.2012

all i want is to create a strcmp cmd that does this cleanup of all users to lvl 0 when i use it..


Re: Editing ALL registered users at once. - [HiC]TheKiller - 07.04.2012

If you want to be able to do that, either create a plugin or switch your file system to MySQL / SQLite.


Re: Editing ALL registered users at once. - Deathh - 07.04.2012

can you give me some examples of what i should put in the plugin itself?


Respuesta: Editing ALL registered users at once. - aNdReSk - 07.04.2012

when player connects, if he hasnt updated yet then set level to 0
no need to update them all right away, just as long as they join they get auto fixed


Re: Editing ALL registered users at once. - Kar - 07.04.2012

heres a nice idea, I used this 2 years ago.

Get a list of your admins, and use a strcmp check in OnPlayerConnect.

if there an admin, continue, else set there level to 0.

This will save you the pain of this, but bring more code to your script.


Re: Editing ALL registered users at once. - Catalyst- - 07.04.2012

Just do this...
pawn Код:
public OnPlayerConnect(playerid)
{
    new string[32], name[24];
    GetPlayerName(playerid, name, 24);
    format(string,sizeof(string), "%s.ini", name); // You will need to change this to your accounts
    if(dini_Exists(string) && dini_Int(string, "Updated") != 1)
    {
        dini_IntSet(string, "Level", 0);
        dini_IntSet(string, "Updated", 1);
    }
    return 1;
}
Now, the first time everyone connects, their level will be reset to 0.