SA-MP Forums Archive
Register text. - 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: Register text. (/showthread.php?tid=586657)



Register text. - Tixxt - 23.08.2015

Hey guys im looking for someone who can make a script so that when someone logs on a text apairs like : A total of x people have registers on the server .

CAn you help me? Rep+++ i even will pay real money for the golden tip


AW: Register text. - Kaliber - 23.08.2015

You just need 2 functions:

PHP код:
stock GetRegisteredPeople()
{
    if(!
fexist("reg.txt")) return 0;
    new 
File:f=fopen("reg.txt"),str[64];
    return 
fread(f,str),fclose(f),strval(str);
}
stock SetRegister(x)
{
    new 
File:f=fopen("reg.txt"),str[64];
    return 
valstr(str,x),fwrite(f,str),fclose(f);
}
//If a player register:
SetRegister(GetRegisteredPeople()+1);
//If you wanna know how many people registered
new str[64];
format(str,sizeof(str),"On the server registered %d people!",GetRegisteredPeople());
SendClientMessage(playerid,-1,str); 
//Edit:
Or you just count all accounts...
If you use mysql just count the rows...
If you use an ini file system like (dini/yini/...) use a file plugin

Greekz


Re: AW: Register text. - Tixxt - 23.08.2015

Quote:
Originally Posted by Kaliber
Посмотреть сообщение
You just need 2 functions:

PHP код:
stock GetRegisteredPeople()
{
    if(!
fexist("reg.txt")) return 0;
    new 
File:f=fopen("reg.txt"),str[64];
    return 
fread(f,str),fclose(f),strval(str);
}
stock SetRegister(x)
{
    new 
File:f=fopen("reg.txt"),str[64];
    return 
valstr(str,x),fwrite(f,str),fclose(f);
}
//If a player register:
SetRegister(GetRegisteredPeople()+1);
//If you wanna know how many people registered
new str[64];
format(str,sizeof(str),"On the server registered %d people!",GetRegisteredPeople());
SendClientMessage(playerid,-1,str); 
Greekz
Thanks so much! My registerd players apaire in the luxadmin folder? Do i need to change anything in the code?


AW: Re: AW: Register text. - Kaliber - 23.08.2015

Quote:
Originally Posted by Tixxt
Посмотреть сообщение
Thanks so much! My registerd players apaire in the luxadmin folder? Do i need to change anything in the code?
A file will be created in the scriptfiles.

And no, you don't need to change anything


Re: Register text. - Tixxt - 23.08.2015

How do i get the script working? Im kind of a noob in scripting these scripts..


Re: Register text. - Tixxt - 23.08.2015

Please i need someone that knows how to do this


AW: Register text. - Kaliber - 23.08.2015

What you dont understand?

...should work fine...just read the comments...


Re: Register text. - Tixxt - 23.08.2015

no but i never put in a script... What do i need to do to make it work? do i need to make a pwn?


Re: Register text. - Tixxt - 23.08.2015

It would be awesome if someone could give a explanation.


AW: Register text. - Kaliber - 23.08.2015

Well...

yes you should open the script (.pwn) and then put the functions (stock ...) at the end of the script and then look where the registration is..and put the things there...

Look how the script is organized