Help in Adding player score
#2

Create a checkpoint?
Put this ongamemodeinit or onfilterscriptinit.
Код:
        CPNAME = CreateDynamicCP(X, Y, Z, 1.3, -1, 0, -1, 65.0); //create a checkpoint named CPNAME at X Y Z
	Create3DTextLabel("[The Finish!]", COLOR_YELLOW, X, Y, Z + 0.2, 7.5, 0, 1); //Place a message above the checkpoint.
Код:
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
 	if(checkpointid == CPNAME) //we named the checkpoint CPNAME so its identified here.
  	{
  	 SendClientMessage(playerid, COLOR_WHITE, "* You completed the challenge!"); // Sending a message.
         SetPlayerScore(playerid, GetPlayerScore(playerid) + 1); // get the players score and add +1
         SendClientMessage(playerid, COLOR_WHITE, "* You gained +1 Score"); // Sending a message.
         GivePlayerMoney(playerid, 1000); // Give the player 1000 Money ontop of his current balance.
  	 SendClientMessage(playerid, COLOR_WHITE, "* You gained $1000 aswell!"); // Sending a message.
	}
Return 1;
}

NOTE this will send the message every time the player enters the checkpoint, so if he walks trough it 5 times he'll gain the reward 5 times, there is no cooldown, if you would like a cooldown, i suggest adding a timer.
Reply


Messages In This Thread
Help in Adding player score - by RaajParker - 30.11.2015, 12:55
Re: Help in Adding player score - by yvoms - 30.11.2015, 13:13
Respuesta: Help in Adding player score - by RaajParker - 30.11.2015, 13:22
Re: Help in Adding player score - by yvoms - 30.11.2015, 13:25
Re: Help in Adding player score - by Sew_Sumi - 30.11.2015, 13:40
Re: Help in Adding player score - by yvoms - 30.11.2015, 13:42

Forum Jump:


Users browsing this thread: 1 Guest(s)