unlimited nos with command
#1

Hi guys i need a code that let the player to use unlimited nos but just if the players writes /unlimitednos or something like that in onplayertext.. i'm tried most of the fs in forum but they don't work and most of them is without command. Thanks
Reply
#2

https://sampforum.blast.hk/showthread.php?tid=37149
You can just use the timer in a command.
Reply
#3

How bro? That's what i don't understand
Reply
#4

pawn Код:
SetTimer("NitroReset", 3000, 1);
Remove that timer from OnFilterScriptInit, and change it to SetTimerEx, then add it under your command.
And ofc. use playerid's instead of the player loops.
Reply
#5

Sorry bro for i'm disturb you but i did something like this. is it right?

if(strcmp(cmd, "/sinirsiznos", true) == 0 || strcmp(cmd, "/unlimitednos", true) == 0)
{
SetTimerEx("NitroReset", 3000, 1);
SendClientMessage(playerid, 0xFF0000FF, "Sэnэrsэz nos aktif edildi!");
return 1;
}
Reply
#6

Wait... I will help you!
Reply
#7

Edit the time (5000 = 5 seconds) like you want: (Not tested)
pawn Код:
new UnlimitedNitro[MAX_PLAYERS];

public OnGameModeInit()
{
    SetTimer("SetUnlimitedNitro", 5000, 1);
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmd, "/sinirsiznos", true) == 0 || strcmp(cmd, "/unlimitednos", true) == 0)
    {
       
        UnlimitedNitro[playerid] = 1;
        SendClientMessage(playerid, 0xFF0000FF, "Sэnэrsэz nos aktif edildi!");
        return 1;
    }
    if(strcmp(cmd, "/unlimitednosoff", true) == 0)
    {
       
        if(UnlimitedNitro[playerid] == 1)
        {
           
            UnlimitedNitro[playerid] = 0;
            if(IsPlayerInAnyVehicle(playerid)) RemoveVehicleComponent(GetPlayerVehicleID(playerid), 1010);
        }
        return 1;
    }
}

forward SetUnlimitedNitro();
public SetUnlimitedNitro()
{
    for(new i=0; i<GetMaxPlayers(); i++)
    {
       
        if(IsPlayerConnected(i) && UnlimitedNitro[i] == 1)
        {
           
            if(IsPlayerInAnyVehicle(i))
            {
               
                RemoveVehicleComponent(GetPlayerVehicleID(i), 1010);
                AddVehicleComponent(GetPlayerVehicleID(i), 1010);
            }
        }
    }
    return 1;
}
Reply
#8

You should just give them 10x, and after you have detected they use it(with the FIRE key), start a timer, and then after around 10 seconds, give another 10x.

Note: This isn't really the ideal solution. For better results, give them NOS when they press FIRE key.
Reply
#9

This is the better system and I used it in my server:

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
       
        if ((((newkeys & (4)) == (4)) && ((oldkeys & (4)) != (4)))) AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
        else if ((((newkeys & (4)) != (4)) && ((oldkeys & (4)) == (4)))) RemoveVehicleComponent(GetPlayerVehicleID(playerid), 1010);
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)