I need help with register system
#1

pawn Код:
//When player disconnects
 new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
    INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
    INI_WriteInt(File,"Admin",AdminLevel[playerid]);
    INI_WriteInt(File,"Donor",vip[playerid]);
    INI_WriteInt(File,"Kills",PlayerInfo[playerid][Kills]);
    INI_WriteInt(File,"Deaths",PlayerInfo[playerid][Deaths]);
    INI_WriteInt(File,"Score",GetPlayerScore(playerid));
    INI_Close(File);
   

//what happens when you kill someone are when you die
 if(killerid != INVALID_PLAYER_ID)
    {
    SendClientMessage(killerid,0xAA3333AA,"Well Done");
    GameTextForPlayer(playerid,"~g~You've Killed A Player And Recieved $2000 + 1 score", 3000, 3);
    pScore[killerid]++;
    SetPlayerScore(killerid, pScore[killerid]);
    GivePlayerMoney(killerid,2000);
    SetPlayerWantedLevel(killerid,1);
    PlayerKills[killerid] ++;
    }
    SendClientMessage(playerid,0xAA3333AA,"You have been killed");
    GameTextForPlayer(playerid,"~r~You have Been killed And You Lost $1000", 3000, 3);
    GivePlayerMoney(playerid,-1000);
    PlayerDeaths[playerid] ++;
 


//the /stats command
CMD:stats(playerid, params[])
{
    new target=playerid;
    if(!isnull(params)) sscanf(params, "r", target);
    new string[200];
    format(string, sizeof(string), "%s's Statistics", GetName(playerid));
    SendClientMessage(playerid, COLOR_BROWN, string);
    format(string, sizeof(string), "[Account]: Score: %i | Money: %i | Kills: %d | Deaths: %d", GetPlayerScore(target), GetPlayerMoney(target), PlayerInfo[target][Kills], PlayerInfo[target][Deaths]);
    SendClientMessage(playerid ,COLOR_BROWN, string);
    format(string, sizeof(string), "[Levels]: Admin Level: %d | Donor Rank: %d", AdminLevel[target], vip[target]);
    SendClientMessage(playerid ,COLOR_BROWN, string);
    return 1;
}
I have made an register system it save the admin level ,cash,password,viplevel and score. But it doesnt save the kills and deaths the code is below:
Reply
#2

Sorry to say, Edit your post and put your codes under [ pawn] [ /pawn] Because cant understand.
Reply
#3

Ah, use [pawn] // your code [/pawn] before posting any code. Plus, you are using different variable for raising kill and death counts. Also, shouldn't the saving code should be placed at OnPlayerDisconnect callback?

pawn Код:
// Using this to raise the counts
PlayerKills[killerid] ++;
PlayerDeaths[playerid] ++;

// Saving with different variables
INI_WriteInt(File,"Kills",PlayerInfo[playerid][Kills]); // ?
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][Deaths]); // ?
Reply
#4

bump
Reply
#5

Try:

pawn Код:
//what happens when you kill someone are when you die
 if(killerid != INVALID_PLAYER_ID)
    {
    SendClientMessage(killerid,0xAA3333AA,"Well Done");
    GameTextForPlayer(playerid,"~g~You've Killed A Player And Recieved $2000 + 1 score", 3000, 3);
    pScore[killerid]++;
    SetPlayerScore(killerid, pScore[killerid]);
    GivePlayerMoney(killerid,2000);
    SetPlayerWantedLevel(killerid,1);
    PlayerKills[killerid] ++;
    }
    SendClientMessage(playerid,0xAA3333AA,"You have been killed");
    GameTextForPlayer(playerid,"~r~You have Been killed And You Lost $1000", 3000, 3);
    GivePlayerMoney(playerid,-1000);
    PlayerInfo[playerid][Kills] ++;
I added see if it work:
pawn Код:
PlayerInfo[playerid][Deaths] ++;
PlayerInfo[playerid][Kills] ++;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)