How to do that?
#1

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

Use a variable.
Reply
#3

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

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;
}
Reply
#5

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

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
Reply
#7

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)
Reply
#8

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
Reply
#9

?
Reply
#10

No one knows?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)