A littile help please!
#1

Hello there, I would need a little help here... So here's what I'm trying to do :
When the player says something, he will get +100 (pPoints). When the player has 100000 points on /stats (his status) his points will be reseted, and he will get a SendClientMessage(playerid, COLOR_whatever, "lol u got 100k points gg"); or something like that,
I figured it's under OnPlayerText so here's what I got, but it only gives him 100 points when he says the first thing on the server.
Example : When you say Hello, you get 100 pPoints but when you say anything else again, you just stay with those 100
Код:
if (realchat)
	{
	  if(gPlayerLogged[playerid] == 0)
	  {
	    return 0;
   	}
		GetPlayerName(playerid, sendername, sizeof(sendername));
		format(string, sizeof(string), "%s Says: %s", sendername, text);
		PlayerInfo[playerid][pPoints]+ 100;//this is kinda it, what should I put here to keep giving him points? :-S
		ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
		return 0;
	}
	return 1;
}
I made the Points part to appear at /stats, it can be saved in the .ini file, but he only gets 100 points when he says any FIRST thing on the server... Also, you can modify someone's points trough /setstat, and it gets saved... But still only +100 when you say any first thing...
Also, more info about the pPoints if you need it :
Код:
if( strcmp( key , "Points" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pPoints] = strval( val ); }
Код:
format(var, 32, "Points=%d\n",PlayerInfo[playerid][pPoints]);fwrite(hFile, var);
Код:
new carpoints = PlayerInfo[targetid][pPoints];
Thanx guys let's see if you can do it
Reply
#2

Well you can do something like this
You make a copy of that : PlayerInfo[playerid][pPoints]
But now example with the name PlayerInfo[playerid][FirstSay]
And you set the PlayerInfo[playerid][FirstSay] to 1 when he said the first thing
Then you put
if(PlayerInfo[playerid][FirstSay] != 1)

Above that fuctions
So something like this:
Код:
if (realchat)
	{
	  if(gPlayerLogged[playerid] == 0)
	  {
	    return 0;
   	}
		if(PlayerInfo[playerid][FirstSay] != 1)
		{
		GetPlayerName(playerid, sendername, sizeof(sendername));
		format(string, sizeof(string), "%s Says: %s", sendername, text);
		PlayerInfo[playerid][pPoints]+ 100;//this is kinda it, what should I put here to keep giving him points? :-S
		ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
		}
		return 0;
	}
	return 1;
}
Reply
#3

And that will give him the 100 points just the first time?
No man I need it to give him 100 points everytime he says something
That's what I am trying to do
Reply
#4

lol damit I thought only the first time. Thats not difficult just give him 100 points each time he says something in OnPlayerText. You already got that.
Reply
#5

Quote:
Originally Posted by MyName?
lol damit I thought only the first time. Thats not difficult just give him 100 points each time he says something in OnPlayerText. You already got that.
Well it's not working I'm trying, but it only gives him the first time! Can you try it and give me a code?
Reply
#6

Anyone?!??!!?
Reply
#7

Код:
PlayerInfo[playerid][pPoints] += 100;
Try this.
Reply
#8

Quote:
Originally Posted by kLx
Код:
PlayerInfo[playerid][pPoints] += 100;
Try this.
Oh yeah that's it thanx man you're the best
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)