[HELP] Timer
#1

Hello,

I need some help with making a timer for something.

I'm making that people can /houseupgrade 3 (that means they can get a weapon).

Now I want to make a timer so people can use /smuggleweapon and need to wait for 30 minutes to get a weapon. This can only be possible in their house. I only got this:


Код:
forward WeaponTimer();
Код:
new weapontimer;
Код:
public WeaponTimer()
{

}
and this killtimer:

Код:
    KillTimer(weapontimer);
And
Код:
weapontimer = SetTimer("WeaponTimer", 60000, 1);
Now I want to make a /getweapon that people can only use in their house and when they got the houseupgrade. And I don't have a clue how to make it, I'm using the LA-RP script aka Godfather.

I hope someone can help me..

And this is the code that I need to take 30 minutes before you get the gun.

Код:
         if(!strcmp(cmdtext, "/smuggleweapon", true))
    {
        if(IsPlayerConnected(playerid))
        {
            if(gPlayerLogged[playerid] == 0)
            {
                SendClientMessage(playerid, COLOR_GREY, "   You need to login first !");
                return 1;
            }
            if (HouseEntered[playerid] = 0)
            {
                SendClientMessage(playerid, COLOR_GREY, "   You can only use /smuggleweapon while you are in your cell !");
                return 1;
            }
            if (HouseEntered[playerid] = 1)
            {
                GivePlayerWeapon(playerid,4,1);
                ApplyAnimation(playerid,"DEALER","shop_pay",4.1,0,0,0,0,0);
                return 1;
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "   You need to /smoke to use this animation ! ");
                return 1;
            }
        }
        return 1;
     }
It also gives this error:
C:\Users\mma\Desktop\San Andreas Server\gamemodes\prpr.pwn(17227) : warning 211: possibly unintended assignment
C:\Users\mma\Desktop\San Andreas Server\gamemodes\prpr.pwn(17232) : warning 211: possibly unintended assignment
Reply
#2

Anyone??
Reply
#3

Make a variable, then you reset it in another callback.
Reply
#4

And how do I do that? I also scripted some more.. And also got a problem with that lawl.. Can you give a example?
Reply
#5

Can anyone answer my question?
Reply
#6

pawn Код:
if(!strcmp(cmdtext, "/smuggleweapon", true))
    {
        if(IsPlayerConnected(playerid))
        {
            if(gPlayerLogged[playerid] == 0)
            {
                SendClientMessage(playerid, COLOR_GREY, "   You need to login first !");
                return 1;
            }
            if (HouseEntered[playerid] = 0)
            {
                SendClientMessage(playerid, COLOR_GREY, "   You can only use /smuggleweapon while you are in your cell !");
                return 1;
            }
            if (HouseEntered[playerid] = 1)
            {
                GivePlayerWeapon(playerid,4,1);
                ApplyAnimation(playerid,"DEALER","shop_pay",4.1,0,0,0,0,0);
                 weapontimer = SetTimer("WeaponTimer", 60000, 1);
                return 1;
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "   You need to /smoke to use this animation ! ");
                return 1;
            }
        }
        return 1;
     }
Then use your timer for what you want??
Reply
#7

It's working now, but I can /smuggleweapon as much I want.. And I don't need to be in a house to smuggle it.. So how do I fix that?
Reply
#8

I now got this:

Код:
    if(!strcmp(cmdtext, "/smuggleweapon", true))
    {
        if(IsPlayerConnected(playerid))
        {
            if(gPlayerLogged[playerid] == 0)
            {
                SendClientMessage(playerid, COLOR_GREY, "   You need to login first !");
                return 1;
            }
            if (HouseEntered[playerid] = 0)
            {
                SendClientMessage(playerid, COLOR_GREY, "   You can only use /smuggleweapon while you are in your cell !");
                return 1;
            }
            if (HouseEntered[playerid] = 1)
            {
                SendClientMessage(playerid, COLOR_GREY, "   You've started smuggling a knife, wait for 30 minutes now.");
                GivePlayerWeapon(playerid,4,1);
                ApplyAnimation(playerid,"DEALER","shop_pay",4.1,0,0,0,0,0);
                weapontimer = SetTimer("WeaponTimer", 60000, 1);
                return 1;
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "   You need to wait ! ");
                return 1;
            }
        }
        return 1;
     }
Reply
#9

pawn Код:
new bool:Weapon[MAX_PLAYERS];

if(!strcmp(cmdtext, "/smuggleweapon", true))
{
    //Why were you checking if player was connected? LOL
    if(Weapon[playerid] != false) return SendClientMessage(playerid, COLOR_WHITE, "You must wait first!");
    {
        if(gPlayerLogged[playerid] == 0) //This must be '==' not '='
        {
            SendClientMessage(playerid, COLOR_GREY, "   You need to login first !");
        }
        if(HouseEntered[playerid] == 0) //This must be '==' not '='
        {
            SendClientMessage(playerid, COLOR_GREY, "   You can only use /smuggleweapon while you are in your cell !");
        }
        if(HouseEntered[playerid] == 1) //This must be '==' not '='
        {
            GivePlayerWeapon(playerid,4,1);
            ApplyAnimation(playerid,"DEALER","shop_pay",4.1,0,0,0,0,0);
            weapontimer = SetTimer("WeaponTimer", 60000, 1);
            Weapon[playerid] = true;
        }
        else
        {
            SendClientMessage(playerid, COLOR_GREY, "   You need to /smoke to use this animation ! ");
        }
    }
    return 1;
}

forward WeaponTimer();
public WeaponTimer()
{
    Weapon[playerid] = false;
    //Your code
}
I suggest you reading some PAWN tutorials..
Reply
#10

I get this error:

Код:
C:\Users\mma\Desktop\San Andreas Server\gamemodes\prpr.pwn(7340) : error 017: undefined symbol "Weapon"
C:\Users\mma\Desktop\San Andreas Server\gamemodes\prpr.pwn(7340) : error 017: undefined symbol "playerid"
C:\Users\mma\Desktop\San Andreas Server\gamemodes\prpr.pwn(7340) : error 029: invalid expression, assumed zero
C:\Users\mma\Desktop\San Andreas Server\gamemodes\prpr.pwn(7340) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664              Copyright © 1997-2006, ITB CompuPhase


4 Errors.
And this is my line where the fault is in:
Код:
public WeaponTimer()
{
    Weapon[playerid] = false; <<- Here is the fault..
    //Your code
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)