unlimited nos with command -
sirvanec - 19.02.2015
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
Re: unlimited nos with command -
CalvinC - 19.02.2015
https://sampforum.blast.hk/showthread.php?tid=37149
You can just use the timer in a command.
Re: unlimited nos with command -
sirvanec - 19.02.2015
How bro? That's what i don't understand
Re: unlimited nos with command -
CalvinC - 19.02.2015
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.
Re: unlimited nos with command -
sirvanec - 19.02.2015
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;
}
Re: unlimited nos with command -
JR_Junior - 19.02.2015
Wait... I will help you!
Re: unlimited nos with command -
JR_Junior - 19.02.2015
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;
}
Re: unlimited nos with command -
Abagail - 19.02.2015
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.
Re: unlimited nos with command -
JR_Junior - 19.02.2015
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;
}