Help me with this, +rep if done.
#2

PHP код:
#include            <a_samp>
#include                <streamer>
#include                <sscanf2>
#include            <zcmd>
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_RED 0xAA3333AA
 
#define MAX_RANDOM_GIFTS 3
 
public OnFilterScriptInit()
{
    print(
"\n--------------------------------------");
    print(
"Gift system by DrVenomous");
    print(
"--------------------------------------\n");
    return 
1;
}
 
#pragma tabsize 0
 
 
stock RandomGift(playerid)
{
    new 
randomgift random(MAX_RANDOM_GIFTS) + 1;
    switch (
randomgift)
    {
        case 
1:
        {
            
GivePlayerMoney(playerid50000);
                        
SendClientMessage(playeridCOLOR_YELLOW"You have won 50000$ enjoy!.");
        }
        case 
2:
        {
            
GivePlayerMoney(playerid10000);
                        
SendClientMessage(playeridCOLOR_YELLOW"You have won 10000$ enjoy!.");
        }
        case 
3:
        {
            
SetPlayerArmour(playerid100);
            
SendClientMessage(playeridCOLOR_YELLOW"You have a vest enjoy!.");
        }
    }
    return 
1;
}
 
 
new 
Float:giftPos[4];
new 
giftboxobject;
new 
giftboxcreated 0;
new 
Text3D:giftbox3DText;
 
 
CMD:giftbox(playeridparams[])
{
        if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1"You are not an admin!");
        if (
isnull(params))
        {
                
SendClientMessage(playerid, -1"/giftbox [Option]");
            
SendClientMessage(playeridCOLOR_YELLOW"[OPTIONS]: place, destroy");
                return 
1;
        }
        static
        
Float:X,
        
Float:Y,
        
Float:Z,
        
Float:A;
 
    
GetPlayerPos(playeridXYZ);
    
GetPlayerFacingAngle(playeridA);
 
        if (!
strcmp(params"place"true))
        {
            if (
IsPlayerInAnyVehicle(playerid))
                return 
SendClientMessage(playeridCOLOR_RED"You must be outside vehicle first.");
                if(
giftboxcreated == 1) return SendClientMessage(playeridCOLOR_RED"Giftbox is already placed.");
            
giftPos[0] = X;
            
giftPos[1] = Y;
            
giftPos[2] = Z;
            
giftboxcreated 1;
            
giftboxobject CreateDynamicObject(19054XY0.40.00.0A);
            
giftbox3DText CreateDynamic3DTextLabel("/getgift\nTo get your gift.",0x10F441AA,XYZ+0.25,8.0);
            
SendClientMessage(playerid, -1"You have placed a giftbox");
                        return 
1;
        }
       
        if (!
strcmp(params"destroy"true))
        {
     if(
giftboxcreated == 0) return SendClientMessage(playeridCOLOR_RED"Giftbox is not placed yet.");
            
DestroyDynamicObject(giftboxobject);
            
DestroyDynamic3DTextLabel(giftbox3DText);
            
giftboxcreated 0;
            
SendClientMessage(playerid, -1"You have destoryed the giftbox");
                        return 
1;
        }
        return 
1;
}
 
CMD:getgift(playerid)
{
        if(!
IsPlayerConnected(playerid))
            return 
SendClientMessage(playerid, -1"You must be logged in to do this.");
 
        
GetObjectPos(giftboxobjectgiftPos[0], giftPos[1], giftPos[2]);
       
        if(
IsPlayerInRangeOfPoint(playerid5.0giftPos[0], giftPos[1], giftPos[2]) && giftboxcreated == 1)
        {
        
RandomGift(playerid);
        }
        return 
1;

Try this, I used in my server and it worked
Reply


Messages In This Thread
Help me with this, +rep if done. - by Oxygenated - 14.09.2017, 15:23
Re: Help me with this, +rep if done. - by DrVenomous - 14.09.2017, 15:35
Re: Help me with this, +rep if done. - by Ultraz - 14.09.2017, 15:53
Re: Help me with this, +rep if done. - by Oxygenated - 14.09.2017, 17:45
Re: Help me with this, +rep if done. - by Sew_Sumi - 15.09.2017, 00:46
Re: Help me with this, +rep if done. - by Oxygenated - 15.09.2017, 03:00
Re: Help me with this, +rep if done. - by StaticYey - 15.09.2017, 05:34
Re: Help me with this, +rep if done. - by Oxygenated - 15.09.2017, 07:44
Re: Help me with this, +rep if done. - by BadJih - 15.09.2017, 09:56
Re: Help me with this, +rep if done. - by StaticYey - 15.09.2017, 11:59

Forum Jump:


Users browsing this thread: 2 Guest(s)