Need help making a small surprise box system for X-MAS
#1

Hey guys,
Title says it all.I want help with making a surprise box system for my server.Just give me the basic idea of it and also please post an example for it so that I understand it better.


Regards,
Bhuvanesh
Reply
#2

Create pickup. On pickup, give reward. Destroy pickup. Can't be that hard.
Reply
#3

Could you please give a small example for it?I would really be thankful if you do so!
Reply
#4

If I were you I would find a box looking object and add the object somewhere in San Andreas were your server is based. Then the player can go up and do something like /openpresent or something and they get their gift.

You would have to use:
CreateObject - http://www.wiki.sa-mp.com/wiki/CreateObject - (To make the gift box)
IsPlayerInRangeOfPoint - http://www.wiki.sa-mp.com/wiki/IsPlayerInRangeOfPoint - (To make sure they're near the giftbox)

Make the command to give them their gift whatever it is... Money... Guns... Armor... etc.
After they use a command save a variable saying they've already opened their Christmas gift.

Then you're done
Reply
#5

How do I randomize it and Make certain things rare?
Reply
#6

pawn Код:
OnGameModeInit()
{
    //code
    CreateObject(327, X, Y, Z, XA, YA, ZA, 25.0); // X Y Z are to be edited, to whatever location you want. Same to angles.
    return 1;
}

CMD:getgift(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 10.0, X, Y, Z)) // X Y Z are to be edited, to whatever location you want. Same to angles.
    {
        new random(5);
        switch(random)
        {
            case 0:
            {
                //code
            }
            case 1:
            {
                //code
            }
            case 2:
            {
                //code
            }
            case 3:
            {
                //code
            }
            case 4:
            {
                //code
            }
            return 1;
        }
    }
    SendClientMessage(playerid, -1, "You are not in range of the gift box.");
    return 1;
}
Example with ZCMD.
Reply
#7

So, instead of putting the object in one spot, I changed it to where it spawns next to an admin. But how would I make the command to /getgift for other players?

Код:
CMD:xmas(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] < 5) return SendClientMessage(playerid, COLOR_GREY,"You are not authorized to use that command!");
	{
		new Float:x,Float:y,Float:z;
		GetPlayerPos(playerid,x,y,z);
		CreateObject(19054,x+1.0,y,z,0.0,1,0,300);
		SendClientMessageToAll(COLOR_RED, "An Admin has set a gift box!");
		return 1;
	}
}
(Dont mind the command. Lol will edit in more detail later)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)