Problem with my reg/log system.
#1

How can i make an register system that also saves your weapons/kills/deaths?

this is what i got now:
pawn Код:
/*  Project Civil War bye Justsomeguy and Marilem.
    This project is about making an change into the world of TDM and finally,
    Not an RP server cuz it is sow overused.
    The server will be more uniqeu then others as this one is made from scratch.
    note to self:
    * watch this vid:
    [ame]http://www.youtube.com/watch?v=xWYdJQGiDFQ[/ame]
    */

#include <a_samp>
#include <streamer>
#include <COLORS>
#include <dini>
#include <dudb>
#define SERVER_USER_FILE "Civil War userfile/%s.ini"


#pragma unused ret_memcpy

enum pInfo
{
    pAdminLevel,
    pCash,
    pScore,
    pWeapons,
}
new PlayerInfo[MAX_PLAYERS][pInfo];

main()
{
    print("\n----------------------------------------");
    print(" Civil War TDM by Justsomeguy and Marilem");
    print("----------------------------------\n");
}


public OnGameModeInit()
{
    // Don't use these lines if it's a filterscript
    SetGameModeText("Blank Script");
    AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    return 1;
}

public OnGameModeExit()
{
    return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
    return 1;
}

public OnPlayerConnect(playerid)
{


    SetPVarInt( playerid , "Logged" , 0 );

    new name[MAX_PLAYER_NAME], file[256];
    GetPlayerName(playerid, name, sizeof(name));
    format(file, sizeof(file), SERVER_USER_FILE, name);
    if (!dini_Exists(file))
    {
        ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Hi your not registered", "Welcome, your not registered mate, input your registration pw below", "Register", "Leave");
    }
    if(fexist(file))
    {
        ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Hi your registered", "Fucken awesome mate, your registered :D. Inpute your pw below", "Login", "Leave");
    }

    GameTextForPlayer(playerid," ~Y~welcome to ~B~Civil War ~R~TDM", 25, 1000);
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    new name[MAX_PLAYER_NAME], file[256];
    GetPlayerName(playerid, name, sizeof(name));
    format(file, sizeof(file), SERVER_USER_FILE, name);
    if(GetPVarInt( playerid , "Logged"))
    {
        dini_IntSet(file, "Score", PlayerInfo[playerid][pScore]);
        dini_IntSet(file, "Money", PlayerInfo[playerid][pCash]);
        dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel]);
        dini_IntSet(file, "Weapons", PlayerInfo[playerid][pWeapons]);
    }
    return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/Goodbyecruelworld!", cmdtext, true, 10) == 0)
    {
        SetPlayerHealth(playerid, 0);
        return 1;
    }
    if (strcmp("/Heal", cmdtext, true, 10) == 0)
    {
        GetPlayerMoney( 2000);
        SetPlayerHealth(playerid, 100);
        return 1;
    }
    if (strcmp("/Buyarmor", cmdtext, true, 10) == 0)
    {
        GetPlayerMoney( 4200);
        SetPlayerArmour(playerid, 1000);
        return 1;
    }
    return 0;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 1)
    {
        new name[MAX_PLAYER_NAME], file[256], string[128];
        GetPlayerName(playerid, name, sizeof(name));
        format(file, sizeof(file), SERVER_USER_FILE, name);

        if  (!response)             return Kick(playerid);
        if  (!strlen(inputtext))    return ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Hi your not registered", "Input your registration password below", "Register", "Leave");
        else
        {
            dini_Create(file);
            dini_IntSet(file, "Password", udb_hash(inputtext));
            dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel] = 0);
            dini_IntSet(file, "Money",PlayerInfo[playerid][pCash] = 500);
            dini_IntSet(file, "Score",PlayerInfo[playerid][pScore] = 0);
            dini_IntSet(file, "Weapons",PlayerInfo[playerid][pWeapons] = 0);
            format(string, 128, "[SYSTEM]: You succesfully registered the nickname %s with password %s, you have been auto logged in.", name, inputtext);
            SendClientMessage(playerid, COLOR_YELLOW, string);
            SetPVarInt( playerid , "Logged" , 1 );
        }
    }
    if(dialogid == 2)
    {
        new name[MAX_PLAYER_NAME], file[256];
        GetPlayerName(playerid, name, sizeof(name));
        format(file, sizeof(file), SERVER_USER_FILE, name);
        if(!response) return Kick(playerid);
        if (!strlen(inputtext)) return ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Hi your registered", "Fucken awesome mate, your registered :D. Inpute your pw below", "Login", "Leave");
        new tmp;
        tmp = dini_Int(file, "Password");
        if(udb_hash(inputtext) != tmp) {
            SendClientMessage(playerid, COLOR_RED, "Wrong PassWord sir.");
            ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Hi your registered", " Inpute your password below", "Login", "Leave");
        }
        else
        {
            SetPVarInt( playerid , "Logged" , 1 );
            PlayerInfo[playerid][pAdminLevel] = dini_Int(file, "AdminLevel");
            SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);
            GivePlayerMoney(playerid, dini_Int(file, "Money")-GetPlayerMoney(playerid));
            SendClientMessage(playerid,COLOR_RED, "[SYSTEM]: Successfully logged in!");
        }
    }
    return 1;
}
Reply
#2

Try this, buddy.

Good luck!
Reply
#3

Show all the lines with an error.. Otherwise I(we) can't help you..
Reply
#4

Quote:
Originally Posted by Luнs Miki
Посмотреть сообщение
Try this, buddy.

Good luck!
Thanks dude!

EDIT:
post updated to my other problem
Reply
#5

please can i get some help :/ cuz it is kinda urgent.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)