[FilterScript] Login/Register system by y_ini (v1)
#1

Hello, this would be the first base of any type of server. Going from freeroam to advance RPG.

Features

Registering account
Logging into the server
Activity counts
Saving system of position
Kills counts with TEXTDRAW
Deaths counts with TEXTDRAW
Loading of position
Loading of all the data stored

Credits

Makers of includes and plugins for :
ZCMD
SSCANF
YSI
Steamer
whirlpool

Commands

savestats : For saving all stats
activity : shows activity ( already in the textdraw )
kills : shows kills ( already in the textdraw )
deaths : shows deaths ( already in the textdraw )


For script :
John_Blaze ( WSRPG )

Usage of this script

It's universal for all types of server. Could be made more advance if worked for sometime.

Codes and file

Pastebin : http://pastebin.com/RUGeau83
.amx : https://www.dropbox.com/s/pawgpilyvf...itled.amx?dl=0
.pwn : https://www.dropbox.com/s/db0k89fv0s...itled.pwn?dl=0

Screens

Album : http://imgur.com/a/LlcyA

Thank you. I tried my best. I welcome your comments.
Message me for request of any tutorial or filterscript, i may release it asap.

-John_Blaze ( WSRPG )
Reply
#2

Don't use udb_hash. You might as well save passwords in plain text. And if you don't want to rely on external plugins, use the native SHA256_PassHash function added in 0.3.7 R2-1.

While it's something trivial, I recommend putting dialogs in an enum to avoid possible ID collisions:
PHP код:
enum  {
    
DIALOG_REGISTER,
    
DIALOG_LOGIN,
    
DIALOG_SUCCESS_1,
    
DIALOG_SUCCESS_2
}; 
Why isn't this in the pInfos enum?
PHP код:
new
    
FloatPosXMAX_PLAYERS ],
    
FloatPosYMAX_PLAYERS ],
    
FloatPosZMAX_PLAYERS ],
    
FloatAngleMAX_PLAYERS ]

You don't need an array with 128 cells to format the file path. The maximum size of the path is 35 characters.
PHP код:
stock UserPath(playerid)
{
    new 
string[128],playername[MAX_PLAYER_NAME];
    
GetPlayerName(playerid,playername,sizeof(playername));
    
format(string,sizeof(string),PATH,playername);
    return 
string;

And the main reason why I decided to check the filterscript was for this:
PHP код:
public OnPlayerDeath(playeridkilleridreason)
{
    
pInfo[killerid][pKills]++;
    
pInfo[playerid][pDeaths]++;
    return 
1;

You have to check whether killerid is a valid player before using it in an array. If you don't, you might eventually end up with an array out of bounds error:
PHP код:
if(killerid != INVALID_PLAYER_ID
I won't point it all out but it seems that you've got a little habit of giving your arrays a size of 128 cells while the maximum size of the formatted string is +-4 times less!

EDIT: You initialized a timer but haven't declared the function for it (It's under case DIALOG_REGISTER):
PHP код:
SetTimer("RegPos",2000,false); 
EDIT2: You should use player textdraws instead of global textdraws. If two or more people connect at the same time, your textdraws will bug.
Reply
#3

Quote:
Originally Posted by AndySedeyn
Посмотреть сообщение
While it's something trivial, I recommend putting dialogs in an enum to avoid possible ID collisions:
PHP код:
enum  {
    
DIALOG_REGISTER,
    
DIALOG_LOGIN,
    
DIALOG_SUCCESS_1,
    
DIALOG_SUCCESS_2
}; 
so if i use
PHP код:
enum {
DIALOG_BLAH
DIALOG_X
}; 
^^ in gamemode
and in a filterscript
PHP код:
enum {
DIALOG_Y
DIALOG_Z
}; 
it wont conflict?
Reply
#4

Quote:
Originally Posted by xTURBOx
Посмотреть сообщение
so if i use
PHP код:
enum {
DIALOG_BLAH
DIALOG_X
}; 
^^ in gamemode
and in a filterscript
PHP код:
enum {
DIALOG_Y
DIALOG_Z
}; 
it wont conflict?
Why would it? They're both in separate .amx files and it will never allocate memory that is in use.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)