SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 19/02/2020, 08:08 AM   #1
GwarrSVK
Little Clucker
 
Join Date: Feb 2020
Posts: 5
Reputation: 0
Default Not saving dini

Hey can someone help with this code ? I need to save money on disconnect and it doesnt work
here is code
https://drive.******.com/open?id=1U_...WtjUN3gTm1jIZC
GwarrSVK is offline   Reply With Quote
Old 19/02/2020, 08:10 AM   #2
Davi52
Little Clucker
 
Join Date: Sep 2018
Posts: 40
Reputation: 0
Default Re: Not saving dini

Can't reach the link!
Davi52 is offline   Reply With Quote
Old 19/02/2020, 08:12 AM   #3
GwarrSVK
Little Clucker
 
Join Date: Feb 2020
Posts: 5
Reputation: 0
Default Re: Not saving dini

#include <dini> //UKLADANIE DÁT
#include <dudb> //------//------
#include <strlib>//-------//------

new IsLogged[MAX_PLAYERS];

enum pInfo
{
AdminLevel,
Cash,
}

new PlayerInfo[MAX_PLAYERS][pInfo];

public OnPlayerDisconnect(playerid, reason)
{ //LOGIN/REGISTER
dini_IntSet("%s.ini", "Cash",GetPlayerMoney(playerid));
IsLogged[playerid] = 0;
return 1;
}

NOTHING ON PLAYER CONNECT

public OnPlayerCommandText(playerid, cmdtext[])
{ //UKLADANIE A ZISŤOVANIE ÚČTA
new cmd[256], idx, file[128], tmp[256], tmp2[256];
cmd = strtok(cmdtext, idx);

if(strcmp(cmd, "/register", true) == 0)
{
new name[MAX_PLAYER_NAME];
tmp = strtok(cmdtext, idx);
GetPlayerName(playerid, name, sizeof(name));
if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /register [password]");
format(file,sizeof(file),"%s.ini",name);
if(!fexist(file))
{
dini_Create(file);
dini_IntSet(file, "Password", udb_hash(tmp));
dini_IntSet(file,"AdminLevel", 0);
dini_IntSet(file,"Cash", 0);
SendClientMessage(playerid, eadmin, "[System]: Účet bol vytvorený!");
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
GetPlayerName(playerid, name, sizeof(name));
printf("%s has registered a account!", name);
}
else
{
SendClientMessage(playerid, COLOR_YELLOW, " Účet bol nájdený v databáze");
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
}
return 1;
}

if(strcmp(cmd, "/login", true) == 0)
{
new PlayerName[24];
tmp = strtok(cmdtext, idx);
if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /login [password]");
new name[MAX_PLAYER_NAME];
if(IsLogged[playerid] == 1)
{
SendClientMessage(playerid, COLOR_YELLOW, "Ste prihlásený!");
return 1;
}
else
{
GetPlayerName(playerid, name, sizeof(name));
format(file,sizeof(file),"%s.ini",name);
if(fexist(file))
{
tmp2 = dini_Get(file, "Password");
if(udb_hash(tmp) != strval(tmp2))
{
SendClientMessage(playerid, COLOR_YELLOW, "Prihlásenie neúspešné!");
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
printf("%s has failed to login", name);
}
else
{
IsLogged[playerid] = 1;
SetPlayerMoney(playerid, dini_Int(file, "Money"));
PlayerInfo[playerid][AdminLevel] = dini_Int(file, "AdminLevel");
SendClientMessage(playerid, COLOR_YELLOW, "[System]: Prihlásený!");
}
}
}
return 1;
}
Attached Files
File Type: pwn TEST.pwn (19.6 KB, 0 views)
GwarrSVK is offline   Reply With Quote
Old 19/02/2020, 08:14 AM   #4
GwarrSVK
Little Clucker
 
Join Date: Feb 2020
Posts: 5
Reputation: 0
Default Re: Not saving dini

Sorry see now you can download it in next reply i posted
GwarrSVK is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[FilterScript] Simple Toy System + Saving with DINI. (saving only 1 slot) PaulDinam Filterscripts 24 20/11/2018 01:36 PM
UCP for Dini Saving? FireNation Server Support 1 07/08/2013 10:02 AM
dini not saving MA_proking Scripting Help 4 21/02/2012 12:37 PM
Good Dini/Dudb tutorial for file saving and info saving for example score ect JoeDaDude Help Archive 2 07/02/2010 09:04 PM
Dini saving Jakku Help Archive 0 14/11/2009 01:33 PM


All times are GMT. The time now is 07:17 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.