SA-MP Forums Archive
Autonos problem - 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: Autonos problem (/showthread.php?tid=310653)



Autonos problem - mave_man - 13.01.2012

In my Gamemode I have

Код:
dcmd(nos,3,cmdtext);
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
 	new bool:AutoNOS[MAX_PLAYERS];
	if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER && AutoNOS[playerid] && (newkeys & KEY_ACTION || newkeys & KEY_FIRE)) AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
	return 1;
}
In commands.inc

I have

Код:
dcmd_nos(playerid,params[])
{
new bool:AutoNOS[MAX_PLAYERS];
if(AutoNOS[playerid])
{
SendClientMessage(playerid, 0x924161FF, "[ ! ] Automatic nitro deactivated.");
AutoNOS[playerid] = false;
}
else
{
SendClientMessage(playerid, 0x924161FF, "[ ! ] Automatic nitro activated!");
AutoNOS[playerid] = true;
}
return 1;
}
Any idea why its not working?


Re: Autonos problem - Stigg - 13.01.2012

Try:
pawn Код:
new AutoNOS[MAX_PLAYERS];//at the top

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER && AutoNOS[playerid] == 1 && (newkeys & KEY_ACTION || newkeys & KEY_FIRE)) AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
    return 1;
}

dcmd_nos(playerid,params[])
{
    #pragma unused params
    if(AutoNOS[playerid] == 1)
    {
        SendClientMessage(playerid, 0x924161FF, "[ ! ] Automatic nitro deactivated.");
        AutoNOS[playerid] = 0;
    }
    else
    {
        SendClientMessage(playerid, 0x924161FF, "[ ! ] Automatic nitro activated!");
        AutoNOS[playerid] = 1;
    }
    return 1;
}



Re: Autonos problem - mave_man - 14.01.2012

Thanks, that fixed it.