Random tips on checkpoint
#1

Hello can some1 help my to do like random tips , i am doing pizza boy job everything set , just need to make random tips when delivery pizza i just need a sample how to make it random value of some variable so i can use that variable when giving money to player
Reply
#2

I didn't understand, tip = advice or tip for money?
Reply
#3

Use that:

pawn Код:
stock randomNum(min, max)
{    
    new rand = random(max-min)+min;    
    return rand;
}
Reply
#4

new Var=random(2000)+1;

This will assign the Var with any value between 0-1999 and add 1 to it.


Just an example of how to assign random values
Reply
#5

Quote:
Originally Posted by cyberlord
Посмотреть сообщение
Hello can some1 help my to do like random tips , i am doing pizza boy job everything set , just need to make random tips when delivery pizza i just need a sample how to make it random value of some variable so i can use that variable when giving money to player
so a random tip?
pawn Код:
GivePlayerMoney(playerid,random(501)+10);
this will give the pizza guy a random tip from minimum 10 to maximum 510
Reply
#6

tnx u everytone another question is this code works :

Код:
GivePlayerMoney(playerid,random(20)+0);
			if(GivePlayerMoney(playerid,random(20)+0) ==0)
			{
                GameTextForPlayer(playerid,"~r~Fucking greedy old man",3000,3);
			}
			else
			{
                GameTextForPlayer(playerid,"~g~You got %d tip",3000,3,random());
			}
if not please tell my what i did wrong
Reply
#7

Quote:
Originally Posted by cyberlord
Посмотреть сообщение
tnx u everytone another question is this code works :

Код:
GivePlayerMoney(playerid,random(20)+0);
			if(GivePlayerMoney(playerid,random(20)+0) ==0)
			{
                GameTextForPlayer(playerid,"~r~Fucking greedy old man",3000,3);
			}
			else
			{
                GameTextForPlayer(playerid,"~g~You got %d tip",3000,3,random());
			}
if not please tell my what i did wrong
partially
you would have to format the message
pawn Код:
new cash = random(20);//don't need 0 it's from 0 to 19 but 0 happens rarely
    GivePlayerMoney(playerid,cash);
    if(!cash)//if its 0, we invert it so that the control statement euqals true to get our message displayed
    {
        GameTextForPlayer(playerid,"~r~Fucking greedy old man",3000,3);
    }
    else//anything besides 0
    {
        new str[18];
        format(str,sizeof str,"~g~You got %d tip",cash);
        GameTextForPlayer(playerid,str,3000,3);
    }
Reply
#8

works tnx u
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)