2 Questions ( Scoring and something else )
#1

Hey,

1.

I've put scoring system in my server. I just put SetPlayerScore etc under OnPlayerDeath.
Well that is working normally, no problems.
But if someone relogs, his score is gone. What must I type and where ? Please, if anyone knows.

2.

I've been wondering for a lot of time..How to make a command like /setage 1-99.
Like you know, you wouldn't make al 99 commands for every /setage, but you would do it in one command. How is that done ? I could really use it with some things in my server and future.

Thank you for replys and help
Reply
#2

1. Save it into a file.
2. strtok/sscanf
Reply
#3

I may help you with your first problem:

This under your SetPlayerScore in OnPlayerDeath where you set the score higher:

pawn Код:
dUserSetINT(PlayerName(playerid)).("score",GetPlayerScore(playerid));
And this to your login command:

pawn Код:
SetPlayerScore(playerid,dUserINT(PlayerName(playerid)).("score")+GetPlayerScore(playerid));
And it saves to your scriptfiles with a player name
Reply
#4

Hey, thanks for the help Jakku.
But;

When I put this under the score at OnPlayerDeath, I get an error - Undefined symblo ''PlayerName''
And since I have Ladmin filterscript, I must put the second command in that filterscript ?

Thanks.
Reply
#5

Plus I get 1 Warning, beside the error.
This is how both look like:

Код:
C:\Documents and Settings\Epp\Desktop\Chio Server 2\Chio server\Xtreme Stunt~Drift~Race~DM\Xtreme Stunt~Drift~Race~DM\SOURCE\gamemodes\SSS.pwn(6851) : warning 219: local variable "PlayerName" shadows a variable at a preceding level
C:\Documents and Settings\Epp\Desktop\Chio Server 2\Chio server\Xtreme Stunt~Drift~Race~DM\Xtreme Stunt~Drift~Race~DM\SOURCE\gamemodes\SSS.pwn(7419) : error 017: undefined symbol "PlayerName"
I'm really confused right now..

And this is where the warning is
Код:
public OnPlayerText(playerid,text[])
{
	SpamStrings[playerid] ++;
	if(SpamStrings[playerid] >= MAX_SPAM)
	{
	  new PlayerName[MAX_PLAYER_NAME];
		GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME);
		printf("(previous text of %s was blocked by antispam)", PlayerName);
		SendClientMessage(playerid,0xCC0000AA,"Please wait 20 seconds before talking again (Spam Protection).");
		return 0;
	}
Reply
#6

Caution: May be buggy, I didn't use STRTOK.

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/setage", cmdtext, true, 10) == 0)
	{
	new string[18];
	if(cmdtext[9] == 0)
		{
		SendClientMessage(playerid, COLOR_[color], "Invalid number, /setage 1-99");
		return 1;
		}
	if(cmdtext[9] != 0)
	  {
		format(string, sizeof(string), "You are %d years old", cmdtext[9]);
	  SendClientMessage(playerid, COLOR_[color], string);
		// Set whatever you variables you want to become to players age.
		return 1;
	}
}
	return 0;
}
Its not tested.

I dont have much hope for it, but good luck hehe
Reply
#7

Thanks, but let's just say I received 26 errors xD
And meh, I care more about the first question now, the scoring - Since I have a stunt server.

But still, thanks for the help
Reply
#8

Quote:
Originally Posted by XtremeChio
Thanks, but let's just say I received 26 errors xD
And meh, I care more about the first question now, the scoring - Since I have a stunt server.

But still, thanks for the help
I thought that much, for those type of things I usually use STRTOK, but I wasn't sure as to whether you had it on your script, it was just a guess, if you want me to make you one with the STRTOK I will .. I don't have anything going on, hehe
Reply
#9

Nah it's alright, I just ment that so I'd know cause when I learn to script better, I'd open an RP server.
But it would help if you could make a command for the first question, so the Scores of players would save

Thanks.
Reply
#10

Please, does anyone know what to do..I just want that players score saves so when he logs in.
I'm really confused, I tried many things, just none works..
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)