doing random number with number range defined - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: doing random number with number range defined (
/showthread.php?tid=275741)
doing random number with number range defined -
henry jiggy - 10.08.2011
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?
Re: doing random number with number range defined -
=WoR=Varth - 10.08.2011
pawn Код:
GivePlayerMoney(killerid,X+ random(X));
Re: doing random number with number range defined -
PrawkC - 10.08.2011
pawn Код:
stock randomEx(min, max)
{
//Credits to ******
new rand = random(max-min)+min;
return rand;
}
learn to search....
Re: doing random number with number range defined -
PrawkC - 10.08.2011
edit; double post, lagged/