[HELP] Score Save add in GM whitout register or login
#1

Hi, Can anybody help me to add score save in my GM whitout /register, /login etc...
I've tried 1000 times on OnPlayerConnect and OnPlayerDisconnect but it does not succeed.

Please Help
Reply
#2

What do you mean? Explain more, please.
Reply
#3

So i want to save score whitout /register or /login.
For Example: I killed 5 people than i've 5 Score points i want to save them when i left the server.
How must i do that?
Reply
#4

You have to use a /register command to save the stats in a file.
Reply
#5

Quote:
Originally Posted by ʞɹod ɹǝpıds || SpiderPork
You have to use a /register command to save the stats in a file.
Hmm... But Doesn't it be going to without?

I tried this code:

Код:
public OnPlayerDisconnect(playerid)
{
	new pname[MAX_PLAYER_NAME];
	new Destination[256];
	new Logged[MAX_PLAYERS];
	GetPlayerName(playerid, pname, sizeof(pname));
	format(Destination,sizeof(Destination),"\\Users\\%s.ini",pname);
	if (dini_Exists(Destination) && Logged[playerid])
 	{
 		dini_IntSet(Destination,"Score", GetPlayerScore(playerid));
 	}
}
But it doesn't works!
Reply
#6

Quote:
Originally Posted by ʞɹod ɹǝpıds || SpiderPork
You have to use a /register command to save the stats in a file.
You don't, duh.

ToD: Search the forums for a register and login filterscript. Copy all the content to your gamemode. Then place OnPlayerRegister in OnPlayerConnect (but do a file name check with player name, and if so take OnPlayerLogin). Easy.

Leopard

EDIT:
Quote:
Originally Posted by ToD
Код:
public OnPlayerDisconnect(playerid)
{
	new pname[MAX_PLAYER_NAME];
	new Destination[256];
	new Logged[MAX_PLAYERS];
	GetPlayerName(playerid, pname, sizeof(pname));
	format(Destination,sizeof(Destination),"\\Users\\%s.ini",pname);
	if (dini_Exists(Destination) && Logged[playerid])
 	{
 		dini_IntSet(Destination,"Score", GetPlayerScore(playerid));
 	}
}
1) You don't need 256 as string size
2) I think \\ is wrong, try \ only
3) What happends if the file name doesn't exist? (name not registered) You gotta create the file.
Reply
#7

Quote:
Originally Posted by [K4L
Leopard ]
Quote:
Originally Posted by ʞɹod ɹǝpıds || SpiderPork
You have to use a /register command to save the stats in a file.
You don't, duh.

ToD: Search the forums for a register and login filterscript. Copy all the content to your gamemode. Then place OnPlayerRegister in OnPlayerConnect (but do a file name check with player name, and if so take OnPlayerLogin). Easy.

Leopard

EDIT:
Quote:
Originally Posted by ToD
Код:
public OnPlayerDisconnect(playerid)
{
	new pname[MAX_PLAYER_NAME];
	new Destination[256];
	new Logged[MAX_PLAYERS];
	GetPlayerName(playerid, pname, sizeof(pname));
	format(Destination,sizeof(Destination),"\\Users\\%s.ini",pname);
	if (dini_Exists(Destination) && Logged[playerid])
 	{
 		dini_IntSet(Destination,"Score", GetPlayerScore(playerid));
 	}
}
1) You don't need 256 as string size
2) I think \\ is wrong, try \ only
3) What happends if the file name doesn't exist? (name not registered) You gotta create the file.
Ok, I'm gonna try it
Reply
#8

Hi Leopard i found a Register and Login Script

http://pastebin.com/f3f4a315a

Is these Aight?
Reply
#9

It's alright it works thanks to all
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)