contest help
#1

this is a contest when player win the contest he got money i want to add score+2 too

please help me here is my CODE
Код:
#define CONTESTTIME 3 //Amounts of minutes till a new contest is started, regardless of the current contest is won or not.
#define MINIMUM_VALUE 2000000 //The minimum value that the contest number may be.
#define MAXIMUM_VALUE 8000000 //The maximum value that the contest number may be.
#define CONTEST_PRIZE 50000// The prize in dollars that the player will win, if he types the answer first.
forward NewContest(); //This'll be called when a new contest begins.
forward OnPlayerWinContest(playerid); //This is for when a player wins the contest.
new ContestAnswer = -1; //Minus 1 (-1). We're using this to show that there's no contest running.
Код:
public NewContest()
{
  new string[128]; //We're creating a new string here to inform players of the new number.
  ContestAnswer = MINIMUM_VALUE + random(MAXIMUM_VALUE-MINIMUM_VALUE);
  format(string,sizeof string,"{0091FF}[Reaction Test]:{FFFFFF} Whoever Will Type This {F81414} %d {FFFFFF} as first, will Win{0091FF} $%d.",ContestAnswer,CONTEST_PRIZE); // This formats a string. More information about strings can be found i
  SendClientMessageToAll(0x00FFFFFF,string); // Color '0x00FFFFFF' is lightblue. The 'string' has just been formatted by us, see the line above. This informs the players that whoever types the contest number first, wins a prize.
  return 1;
}

public OnPlayerWinContest(playerid)
{
  new pName[MAX_PLAYER_NAME],string[128]; // A pName variable for the player's name, and a string to output.
  GetPlayerName(playerid,pName,sizeof pName); //Get's the player's name.
  format(string,sizeof string,"{EEEE00}%s{FFFFFF} Has Won The Reaction Contest{EEEE00} [Prize :%d]",pName,CONTEST_PRIZE);
  SendClientMessageToAll(0x00FFFFFF,string); //Same color, and it outputs a string.
  GivePlayerMoney(playerid,CONTEST_PRIZE);
  ContestAnswer = -1;
  return 1;
}
Reply
#2

pawn Код:
#define CONTEST_SCORE 2 // u can change it
OnPlayerWinContest add this:
pawn Код:
SetPlayerScore(playerid, GetPlayerScore(playerid) + CONTEST_SCORE);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)