random word
#1

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?
Reply
#2

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

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;
}
Reply
#4

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

* manchestera kiss hiddos on the forehead

Thanks man had some many people whinning of this XD
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)