07.06.2011, 20:04
Hello, once again, I've got a problem..
Could you help me?
Well, I wrote a small filterscript that allows you to fly and autorepair by writing command "/funmodeon"
and "/funmodeoff" that turns it off. But when I turning it off, the autofix is still running for some reason..
Can you help me to fix it please?
Here is the code:
Could you help me?
Well, I wrote a small filterscript that allows you to fly and autorepair by writing command "/funmodeon"
and "/funmodeoff" that turns it off. But when I turning it off, the autofix is still running for some reason..
Can you help me to fix it please?
Here is the code:
Код:
#include <a_samp> #define FILTERSCRIPT forward AutoR(); new flying; #define PRESSED(%0) \ (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0))) public OnFilterScriptInit() { print("\n--------------------------------------"); print("Auto Repair loaded"); print("--------------------------------------\n"); return 1; } public OnFilterScriptExit() { return 1; } public OnPlayerCommandText(playerid, cmdtext[]) { flying = 0; new autofix; if(strcmp(cmdtext, "/funmodeon", true) == 0) { autofix = SetTimer("AutoR", 1000, 1); flying = 1; GameTextForAll("~g~Auto Fix is Enabled", 5000, 3); } if(strcmp(cmdtext, "/funmodeoff", true) == 0) { KillTimer(autofix); flying = 0; GameTextForAll("~r~Auto Fix is disabled. ]Kill Time!]", 5000, 3); } } public AutoR() { for(new playerid=0; playerid<MAX_PLAYERS; playerid++) { if(IsPlayerConnected(playerid)) { new Float:health, cid; if (IsPlayerInAnyVehicle(playerid)) { cid = GetPlayerVehicleID(playerid); GetVehicleHealth(cid, health); if (health < 999) { RepairVehicle(cid); SetVehicleHealth(cid,1000); } } } } return 1; } public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { if (flying == 1) { //fly h button if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER) { if (PRESSED(KEY_CROUCH)) { new Float:x, Float:y, Float:z; GetVehicleVelocity(GetPlayerVehicleID(playerid), x, y, z); SetVehicleVelocity(GetPlayerVehicleID(playerid) ,x ,y ,z+0.3); } } } return 1; }