How do I set Random Prizes?
#1

Hello, I made a cute minigame.. and I need your help guys..

1.) I set that When you type this command you will win 10,000$
How do I set that the player who type this will win random prize..
for example.. once he'll win 10,000$
second time he will win Drugs, Materials, Weapons.. etc
Because I don't want it to be just money..
Код:
CMD:parkourprize(playerid, params[]) {
	if(IsPlayerInRangeOfPoint(playerid, 3, -136.100921, 2145.677246, 292.571868)) {
	SetPlayerPos(playerid, 1756.725952, -1770.319335, 17.227943);
	SetPlayerVirtualWorld(playerid, 0);
	SetPlayerHealth(playerid, 100);
	GivePlayerCash(playerid, 10000);
	SendClientMessage(playerid, COLOR_YELLOW, "Congratulations, you won 10,000$");
	StopAudioStreamForPlayer(playerid);
	return 1;
	}
}
2.) How do I set Timer to this command?
for example, I want that the player will be able to use this command once a hour..
Reply
#2

You've gotta use Random, and you use a tick counter dropping down to 0 when they can actually use it.


Like, sorry, but this section isn't for simply pasting up some code and getting other crap added to it... After all you can ask for a scripter to do this for you in the "Looking for Scripters/Mappers" thread.


People aren't here for you to simply ask for crap to be added, it's more so you can post up your code and DEBUG it, not ADD NEW FEATURES.
Reply
#3

pawn Код:
new value = random(5);
if(value == 0)
{
    // random prize 1
}
else if(value == 1)
{
    // random prize 2
}
else if(value == 3)
{
    // random prize 3
}
else if(value == 4)
{
    // random prize 4
}
Reply
#4

Quote:
Originally Posted by jackx3rx
Посмотреть сообщение
pawn Код:
new value = random(5);
if(value == 0)
{
    // random prize 1
}
else if(value == 1)
{
    // random prize 2
}
else if(value == 3)
{
    // random prize 3
}
else if(value == 4)
{
    // random prize 4
}
and after that, what should I type in the parkourprize cmd?
Reply
#5

A random price.
Reply
#6

Quote:
Originally Posted by jackx3rx
Посмотреть сообщение
pawn Код:
new value = random(5);
if(value == 0)
{
    // random prize 1
}
else if(value == 1)
{
    // random prize 2
}
else if(value == 3)
{
    // random prize 3
}
else if(value == 4)
{
    // random prize 4
}
Quote:
Originally Posted by davidstyle1125
Посмотреть сообщение
and after that, what should I type in the parkourprize cmd?
Quote:
Originally Posted by JohnBlade
Посмотреть сообщение
A random price.
And this is the EXACT reason on WHY you SHOULDN"T post up code to people simply wanting something coded.

He'll keep coming back constantly asking where to put it, what to put... This also doesn't teach them a single thing.
Reply
#7

Actually before I opened my server i had 0 knowledge in this.. seriously, 0. I didn't even know how to Comply..
but after asking for help and teaching me this i've learn alot.. Well, sorry if I'm not supposed to post here..
I won't post here again.
Reply
#8

Well davidstyle search for some tutorials on the internet then.
Reply
#9

Consider using a switch statement instead of if statements.

pawn Код:
switch(random(4))
{
    case 0:
    {
        // something here
    }
   
    case 1:
    {
        // something here
    }

    case 2:
    {
        // something here
    }

    case 3:
    {
        // something here
    }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)