SA-MP Forums Archive
How to do that? - 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: How to do that? (/showthread.php?tid=421245)



How to do that? - NeyMar96 - 08.03.2013

How to do command that player can use the command only 3 times in day?


Re: How to do that? - DiGiTaL_AnGeL - 08.03.2013

Use a variable.


Re: How to do that? - NeyMar96 - 08.03.2013

Quote:
Originally Posted by DiGiTaL_AnGeL
Посмотреть сообщение
Use a variable.
Can you give me the code to example ?


Re: How to do that? - DiGiTaL_AnGeL - 08.03.2013

pawn Код:
new used[MAX_PLAYERS] = 0;
I used YCMD:
pawn Код:
YCMD:test(playerid, params[], help)
{
    #pragma unused params, help//we're just making a test command, we don't need those
    if(used[playerid] > 3)//we check if the variable's value is bigger then 3
    {
        SendClientMessage(playerid, 0xFF0000FF, "You've used this command three times!");
    }
    else
    {
        //do your code
        used[playerid]++;//we will set the variable's value bigger with on number
    }
    return 1;
}



Respuesta: How to do that? - Strier - 08.03.2013

Ignore this, i thought you mean once 3 each 3 days .


Re: How to do that? - NeyMar96 - 08.03.2013

Quote:
Originally Posted by DiGiTaL_AnGeL
Посмотреть сообщение
pawn Код:
new used[MAX_PLAYERS] = 0;
I used YCMD:
pawn Код:
YCMD:test(playerid, params[], help)
{
    #pragma unused params, help//we're just making a test command, we don't need those
    if(used[playerid] > 3)//we check if the variable's value is bigger then 3
    {
        SendClientMessage(playerid, 0xFF0000FF, "You've used this command three times!");
    }
    else
    {
        //do your code
        used[playerid]++;//we will set the variable's value bigger with on number
    }
    return 1;
}
I mean that player can use cmd 3 times in one day also if he leave/server shoutdown


Re: How to do that? - absolute - 08.03.2013

pawn Код:
forward Shittimer();
public Shittimer()
{
    if(strfind("/shit", "/shit", true))
    {
        SendClientMessageToAll(0xFFFF00AA,"3 timesa day dude!");
        return 0;
    }
    return 1;
}

public OnPlayerText(playerid, text[])
{
    if(strfind(text, "/shit", true) > 3)
    {
        SendClientMessage(playerid, -3, "3 times a day dude!");
        SetTimer("Shittimer",86400000,0);
        return 0;
    }
    return 1;
}

    CMD:shit(playerid, params[])
    {
        SetPlayerHealth(playerid, 100);
        return 1;
    }
hmmm maybe this one? (didn't test it yet)


Re: How to do that? - NeyMar96 - 08.03.2013

Quote:
Originally Posted by absolute
Посмотреть сообщение
pawn Код:
forward Shittimer();
public Shittimer()
{
    if(strfind("/shit", "/shit", true))
    {
        SendClientMessageToAll(0xFFFF00AA,"3 timesa day dude!");
        return 0;
    }
    return 1;
}

public OnPlayerText(playerid, text[])
{
    if(strfind(text, "/shit", true) > 3)
    {
        SendClientMessage(playerid, -3, "3 times a day dude!");
        SetTimer("Shittimer",86400000,0);
        return 0;
    }
    return 1;
}

    CMD:shit(playerid, params[])
    {
        SetPlayerHealth(playerid, 100);
        return 1;
    }
hmmm maybe this one? (didn't test it yet)
No working


Re: How to do that? - NeyMar96 - 09.03.2013

?


Re: How to do that? - NeyMar96 - 09.03.2013

No one knows?