02.08.2012, 19:12
This is a better version of your code ... To activate the nos, hold the ALT, CTRL, FIRE key ...
A couple of things you need.
---1. zcmd include by Zeex: https://sampforum.blast.hk/showthread.php?tid=91354
---2. foreach include by ******: https://sampforum.blast.hk/showthread.php?tid=92679
A couple of things you need.
---1. zcmd include by Zeex: https://sampforum.blast.hk/showthread.php?tid=91354
---2. foreach include by ******: https://sampforum.blast.hk/showthread.php?tid=92679
Код:
#define PRESSED(%0) \ (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0))) #define RELEASED(%0) \ (((newkeys & (%0)) != (%0)) && ((oldkeys & (%0)) == (%0))) new bool:nfsnos_mod[MAX_PLAYERS]= {false, ...}; public OnGameModeInit() { SetTimer("NFSnos_time", 300, true); return 1; } public NFSnos_time() { foreach(new i : Player) { if(nfsnos_mod[i] && GetPlayerState(i) == PLAYER_STATE_DRIVER) { AddVehicleComponent(GetPlayerVehicleID(i), 1010); } } return 1; } public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { if(IsPlayerInAnyVehicle(playerid)) { if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER && (PRESSED(KEY_ACTION) || RELEASED(KEY_ACTION) || PRESSED(KEY_FIRE) || RELEASED(KEY_FIRE))) { AddVehicleComponent(GetPlayerVehicleID(playerid), 1010); } if(PRESSED(KEY_SUBMISSION)) { RepairVehicle(GetPlayerVehicleID(playerid)); SetVehicleHealth(GetPlayerVehicleID(playerid), 1000.0); PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0); } } return 1; } CMD:nfsnos(playerid, params[]) { if(nfsnos_mod[playerid]) { nfsnos_mod[playerid] = false; SendClientMessage(playerid, 0xFF0000FF, "NFS nos activated"); } else { nfsnos_mod[playerid] = true; SendClientMessage(playerid, 0xFF0000FF, "NFS nos deactivated"); } return 1; }