Tick - To limit command useage
#1

Everything works perfectly, but... Why this tick doesn't work anymore?

pawn Код:
new g_bCrackState[MAX_PLAYERS];
new g_tCrackTick[MAX_PLAYERS];



public OnPlayerSpawn(playerid)
{
    SetTimer("AutoCrack", 3500, true);
    SetPlayerSkin(playerid, 28);
    GivePlayerWeapon(playerid, 24, 50);
    GivePlayerWeapon(playerid, 25, 50);
    GivePlayerWeapon(playerid, 29, 300);
    GivePlayerWeapon(playerid, 30, 300);
    return 1;
}



public OnPlayerCommandText(playerid, cmdtext[])
{
    new
        Float:health;

    GetPlayerHealth(playerid, health);

    if (strcmp("/getup", cmdtext, true, 6) == 0)
    {
        GetPlayerHealth(playerid,health);
        if(health < 20.0)
        if ((GetTickCount() - g_tCrackTick[playerid]) > 15000)
        {
            SetPlayerHealth(playerid, 21);
            TogglePlayerControllable(playerid, true);
            ApplyAnimation(playerid,"PED","getup_front",5.0,0,1,1,1,1,1);
            SendClientMessage(playerid, 0x4AF8FF, " You've successfully got up! Remember to roleplay your injuries. ");
            g_bCrackState[playerid] = 0;
         }
    }



public AutoCrack(playerid)
{
    new Float:health;

    GetPlayerHealth(playerid,health);
    if(health < 20.0 && !g_bCrackState[playerid])
    {
        TogglePlayerControllable(playerid, false);
        ApplyAnimation(playerid,"PED","KO_spin_L",3.0,0,1,1,1,1,1);
        g_bCrackState[playerid] = 1;
    }
    return 1;
}

Everything else works perfectly, but I can spam /getup as much as I want... Why's that? Why the tick won't limit it?
Reply
#2

pawn Код:
if ((GetTickCount() - g_tCrackTick[playerid]) > 15000)
        {
            SetPlayerHealth(playerid, 21);
            TogglePlayerControllable(playerid, true);
            ApplyAnimation(playerid,"PED","getup_front",5.0,0,1,1,1,1,1);
            SendClientMessage(playerid, 0x4AF8FF, " You've successfully got up! Remember to roleplay your injuries. ");
            g_bCrackState[playerid] = 0;
            g_tCrackTick[playerid] = GetTickCount();//add this.
         }
You for got add the part where it gets the tick after the command is executed!

BTW: Hi John Mitchell.
Reply
#3

Oh yes, someone did re-write the code when I needed help with it before (blank script, gave the whole script to people to take a look at it what's wrong) so he totally destroyed the tick :S (Thank god I had my tick backupped lol)
Reply
#4

Ahh good, I'm Johnny Adriani/Deshawn Blackman/Carl Lincoln off CiscoCity if you didn't know. I don't play there anymore much, I'm working on my own project now.

Good luck with what ever you are doing.

EDIT:PM me if you need anymore help.
Reply
#5

I don't think you should start a new community... Cisco might at least have a chance due to active players (and me ^_^) but... It's just too late to start servers anymore

But good luck to you too
Reply
#6

Mehh, Cisco has no active players anymore. And I mostly script for the fun of it(IDK if many people enjoy PAWN, but I do haha). I'm gonna try doing it, new custom script should maybe get some people haha(I hope).

Well c'ya around.
Reply
#7

Quote:
Originally Posted by JhnzRep
Посмотреть сообщение
Mehh, Cisco has no active players anymore. And I mostly script for the fun of it(IDK if many people enjoy PAWN, but I do haha). I'm gonna try doing it, new custom script should maybe get some people haha(I hope).

Well c'ya around.
Well custom script is cool, but you'll never get the real SA:MP players, bet. You'll get much newbie's for sure, but not old schools like me. :P

What I want is like Cisco script has (but should hae a bit more, which i'm trying to create myself, which i've seen back in my old days) like, PR-RP 2008, -09, -10, dropgun, every newbie won't QQ if there's more than one shootout per a year etc.


I believe we should continue in user messages, to stop spamming the section ^_^
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)