SA-MP Forums Archive
Need help making a small surprise box system for X-MAS - 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)
+--- Thread: Need help making a small surprise box system for X-MAS (/showthread.php?tid=395409)



Need help making a small surprise box system for X-MAS - bhuvanesh - 26.11.2012

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


Re: Need help making a small surprise box system for X-MAS - Vince - 26.11.2012

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


Re: Need help making a small surprise box system for X-MAS - bhuvanesh - 26.11.2012

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


Re: Need help making a small surprise box system for X-MAS - iTzZh - 26.11.2012

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


Re: Need help making a small surprise box system for X-MAS - bhuvanesh - 27.11.2012

How do I randomize it and Make certain things rare?


Re: Need help making a small surprise box system for X-MAS - maramizo - 27.11.2012

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.


Re: Need help making a small surprise box system for X-MAS - ArmandoRamiraz - 27.11.2012

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)