doing random number with number range defined
#1

So i have this code here

Код:
public OnPlayerDeath(playerid, killerid, reason)
{
 	SendDeathMessage(killerid, playerid, reason);

	// check if the player is connected
	if(IsPlayerConnected(killerid))
{
	// if the killer's team = killed player's team, then...
	if(gTeam[playerid]==gTeam[killerid])
	{
		// reduce his score by 2
		SetPlayerScore(killerid,GetPlayerScore(killerid)-2);
		// send him a red message saying that he lost 2 points
		SendClientMessage(killerid,0xFF3030AA,"DONT TEAMKILL!!You lost 2 points as punishment.");
	}
	// if player's ID isn't = killer's ID the killer had to kill an enemy, so let's add him a point,and give him MONIES :D $$$
	else
	{
  		SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
  		GivePlayerMoney(killerid, );
	}
}
	return 1;
}
and i wanna add a random value of cash to award here:

Код:
GivePlayerMoney(killerid,(RANDOM AMMOUNT BETWEEN X and X here );
any way to do that?
Reply
#2

pawn Код:
GivePlayerMoney(killerid,X+ random(X));
Reply
#3

pawn Код:
stock randomEx(min, max)
{    
    //Credits to ******    
    new rand = random(max-min)+min;    
    return rand;
}
learn to search....
Reply
#4

edit; double post, lagged/
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)