SA-MP Forums Archive
random word - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: random word (/showthread.php?tid=291978)



random word - manchestera - 22.10.2011

I have seen before a system where a random group of letters pop up and if you type it correct you again so many point how do they do this?


Re: random word - AeroBlast - 22.10.2011

https://sampforum.blast.hk/showthread.php?tid=157947
This is with numbers, but..


Re: random word - manchestera - 22.10.2011

Ive sort of got it working but it is setting the score to 5 not adding 5

Код:
#include <a_samp>
#define CONTESTTIME 3
#define MINIMUM_VALUE 2000000
#define MAXIMUM_VALUE 8000000
#define CONTEST_PRIZE 5
new ContestAnswer = -1;
forward NewContest();
forward OnPlayerWinContest(playerid);
public OnFilterScriptInit()
{
	SetTimer("NewContest",(1000*60*CONTESTTIME),1);
	return 1;
}

public OnPlayerText(playerid, text[])
{
	if(strval(text) == ContestAnswer && ContestAnswer != -1)
	{
		OnPlayerWinContest(playerid);
	}
	return 1;
}

public NewContest()
{
	new string [128];
	ContestAnswer = MINIMUM_VALUE + random(MAXIMUM_VALUE-MINIMUM_VALUE);
	format(string,sizeof string,"A new contest has started. Whoever types %d first, wins $%d.",ContestAnswer,CONTEST_PRIZE);
	SendClientMessageToAll(0x00FFFFFF,string);
	return 1;
}

public OnPlayerWinContest(playerid)
{
	new pName[MAX_PLAYER_NAME],string[128];
	GetPlayerName(playerid,pName,sizeof pName);
	format(string,sizeof string,"Player %s has won the contest and has won %d!",pName,CONTEST_PRIZE);
	SendClientMessageToAll(0x00FFFFFF,string);
	SetPlayerScore(playerid,CONTEST_PRIZE);
	ContestAnswer = -1;
	return 1;
}



Re: random word - Hiddos - 22.10.2011

Change your SetPlayerScore line to this:
pawn Код:
SetPlayerScore(playerid, GetPlayerScore(playerid) + CONTEST_PRIZE);
Good luck


Re: random word - manchestera - 22.10.2011

* manchestera kiss hiddos on the forehead

Thanks man had some many people whinning of this XD