Give Gift block
#1

Код:
CMD:getgift(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 10, -1549.7174,582.2617,7.1797))return SendClientMessage(playerid, COLOR_YELLOW,"You are not near any xmas tree.");
	{
        new rand = random(4);
        switch(rand)
        {
            case 0: GivePlayerMoney(playerid, 5139525);
            case 1: GivePlayerWeapon(playerid, 31, 200); 
            case 2: SetPlayerSkin(playerid, 264); 
            default: SendClientMessage(playerid, COLOR_YELLOW,"You found a present");
   			}
	}
    return 1;
}
how i can make so players cant type that command in next 30 minutes?
Reply
#2

pawn Код:
CMD:getgift(playerid, params[])
    {
        if(GetPVarInt(playerid,"GiftRequest")>GetTickCount()) return SendClientMessage(playerid, COLOR_YELLOW,"You can use this command every 30 minutes");
        if(IsPlayerInRangeOfPoint(playerid, 10, -1549.7174,582.2617,7.1797))return SendClientMessage(playerid, COLOR_YELLOW,"You are not near any xmas tree.");
        {
            new rand = random(4);
            switch(rand)
            {
                case 0: GivePlayerMoney(playerid, 5139525);
                case 1: GivePlayerWeapon(playerid, 31, 200);
                case 2: SetPlayerSkin(playerid, 264);
                default: SendClientMessage(playerid, COLOR_YELLOW,"You found a present");
                SetPVarInt(playerid,"GiftRequest",GetTickCount()+1800000);
            }
        }
        return 1;
    }
Reply
#3

Код:
C:\Users\Beljulji\Documents\Samp Server\filterscripts\[MV]_Christmas1.2.pwn(945) : error 002: only a single statement (or expression) can follow each "case"
C:\Users\Beljulji\Documents\Samp Server\filterscripts\[MV]_Christmas1.2.pwn(945) : warning 215: expression has no effect
C:\Users\Beljulji\Documents\Samp Server\filterscripts\[MV]_Christmas1.2.pwn(947) : warning 209: function "cmd_getgift" should return a value
C:\Users\Beljulji\Documents\Samp Server\filterscripts\[MV]_Christmas1.2.pwn(948) : error 010: invalid function or declaration
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Reply
#4

wich lines of code are ?
Reply
#5

Reply
#6

try this

pawn Код:
new getgiftCcount[MAX_PLAYERS];
CMD:getgift(playerid, params[])
{
    if(getgiftCcount[playerid] > GetTickCount()) return SendClientMessage(playerid, COLOR_YELLOW,"You can use this command every 30 minutes");
    if(IsPlayerInRangeOfPoint(playerid, 10, -1549.7174,582.2617,7.1797))return SendClientMessage(playerid, COLOR_YELLOW,"You are not near any xmas tree.");
    {
        new rand = random(4);
        switch(rand)
        {
            case 0: {
                GivePlayerMoney(playerid, 5139525);
            }
            case 1: {
                GivePlayerWeapon(playerid, 31, 200);
            }
            case 2: {
                SetPlayerSkin(playerid, 264);
            }
            default: {
                SendClientMessage(playerid, COLOR_YELLOW,"You found a present");
            }
        }
        getgiftCcount[playerid] = GetTickCount() + 1800000;
    }
    return 1;
}
then if work try the case n: function like you do
Reply
#7

now works but tree is in sf and i am in ls and says i found present LOL
Reply
#8

you take the correct position on IsPlayerInRange.. ?
try use 10.0 and not 10 for range
Reply
#9

oh yeah i was thinking that now too let me check
Reply
#10

well doesnt say that im not near tree and when i type cmd again i cant use it 30 minutes WTF? LOL
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)