14.02.2014, 07:50
As the title says, I was working on a filterscript and was almost done, when I realized my GM commands stopped working, and the server wasn't outputting "unknown command" or anything. Here's my Commands:
And heres the filterscript:
Код:
public OnPlayerCommandText(playerid, cmdtext[]) { if (strcmp("/tcar", cmdtext, true, 5) == 0) { new Float:x,Float:y,Float:z; new Float:a; GetPlayerPos(playerid, x, y, z); GetPlayerFacingAngle(playerid, a); Tcar=CreateVehicle(560,x, y+5, z, a,111,103, -1); AddVehicleComponent(Tcar, 1138); AddVehicleComponent(Tcar, 1026); AddVehicleComponent(Tcar, 1033); AddVehicleComponent(Tcar, 1010); AddVehicleComponent(Tcar, 1082); AddVehicleComponent(Tcar, 1141); AddVehicleComponent(Tcar, 1169); ChangeVehiclePaintjob(Tcar, 2); return 1; } if (strcmp("/tboat", cmdtext, true, 6) == 0) { new Float:x,Float:y,Float:z; new Float:a; GetPlayerPos(playerid, x, y, z); GetPlayerFacingAngle(playerid, a); Tboat=CreateVehicle(430,x, y+5, z, a,111,103, -1); return 1; } if (strcmp("/tjet", cmdtext, true, 5) == 0) { new Float:x,Float:y,Float:z; new Float:a; GetPlayerPos(playerid, x, y, z); GetPlayerFacingAngle(playerid, a); Tjet=CreateVehicle(520,x, y+5, z, a,111,103, -1); return 1; } if (strcmp("/tcash", cmdtext, true, 6) == 0) { GivePlayerMoney(playerid, 9999999); return 1; } if(strcmp(cmdtext, "/me", true, 3) == 0) { if(!cmdtext[3])return SendClientMessage(playerid, COLOR_RED, "USAGE: /me [text]"); new str[128]; GetPlayerRPName(playerid, str, sizeof(str)); format(str, sizeof(str), "*%s %s", str, cmdtext[4]); SendLocalMessage(playerid, COLOR_PURPLE, 7, str); return 1; } return 1; } public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) { return 1; } public OnPlayerExitVehicle(playerid, vehicleid) { if (vehicleid==Tcar) { DestroyVehicle(Tcar); } if (vehicleid==Tboat) { DestroyVehicle(Tboat); } if (vehicleid==Tjet) { DestroyVehicle(Tjet); } return 1; }
Код:
/* * * * * * * * * * * * * ** * * * * * * * * * * * * * * * * * * * ** SIMPLE VEHICLE RENT SYSTEM BY RIO AKA FIRES Rewritten by Aerotactics * * * * * * * ** * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include <a_samp> #define FILTERSCRIPT #define GREEN 0x00FF00AA #define BLUE 0x0000FFAA #define RED 0xFF0000AA new Vehicle[10]; new InVehicle[MAX_PLAYERS]; new InRent[MAX_PLAYERS]; new lastvehicle[MAX_VEHICLES] = (-1); #if defined FILTERSCRIPT public OnFilterScriptInit() { print("================================================="); print("=Vehicle rent system V.1 by Rio aka Fires loaded="); print("=========Script rewritten by Aerotactics========="); print("================================================="); /* Put Vehicles Here */ Vehicle[0] = AddStaticVehicle(421,1560.4000200,-2321.8999000,13.3000000,270.0000000,6,6); //Vehicle[1] = AddStaticVehicle(...); //Vehicle[2] = AddStaticVehicle(...); //Vehicle[3] = AddStaticVehicle(...); //Vehicle[4] = AddStaticVehicle(...); //Vehicle[5] = AddStaticVehicle(...); //Vehicle[6] = AddStaticVehicle(...); //Vehicle[7] = AddStaticVehicle(...); //Vehicle[8] = AddStaticVehicle(...); //Vehicle[9] = AddStaticVehicle(...); return 1; } #endif public OnPlayerConnect(playerid) { InVehicle[playerid] = 0; InRent[playerid] = 0; return 1; } public OnPlayerDisconnect(playerid, reason) { InVehicle[playerid] = 0; InRent[playerid] = 0; SetVehicleToRespawn(GetPlayerVehicleID(playerid)); return 1; } public OnPlayerDeath(playerid, killerid, reason) { InVehicle[playerid] = 0; InRent[playerid] = 0; SetVehicleToRespawn(GetPlayerVehicleID(playerid)); return 1; } public OnPlayerCommandText(playerid, cmdtext[]) { if (strcmp("/rentcar", cmdtext, true, 10) == 0) { if(GetPlayerMoney(playerid) <=500) { SendClientMessage(playerid, RED, "You don't have enough money to rent this vehicle. (500$)"); RemovePlayerFromVehicle(playerid); TogglePlayerControllable(playerid,1); return 1; } if(InVehicle[playerid] == 0) { SendClientMessage(playerid, RED, "You are not in a rental vehicle."); return 1; } else { SendClientMessage(playerid, GREEN, "You are under a rental agreement for this vehicle. If you abandon"); SendClientMessage(playerid, GREEN, "the vehicle, it will be returned to the lot after 10 minutes."); SendClientMessage(playerid, GREEN, "Disconnecting, Dieing, or destroying the vehicle also breaks"); SendClientMessage(playerid, GREEN, "the contract. You can unrent the car at any time with /unrentcar"); InRent[playerid] = 1; GivePlayerMoney(playerid, -500); TogglePlayerControllable(playerid,1); return 1; } } if (strcmp("/exitrentcar", cmdtext, true, 10) == 0) { if(InVehicle[playerid] == 0 || InRent[playerid] == 0) { SendClientMessage(playerid, RED, "You are not in a rental vehicle."); return 1; } else { RemovePlayerFromVehicle(playerid); TogglePlayerControllable(playerid,1); return 1; } } if (strcmp("/unrentcar", cmdtext, true, 10) == 0) { if(InRent[playerid] == 0) { SendClientMessage(playerid, RED, "You are not renting a vehicle."); return 1; } else { SendClientMessage(playerid, BLUE, "You have left the rental car."); InRent[playerid] = 0; InVehicle[playerid] = 0; RemovePlayerFromVehicle(playerid); SetVehicleToRespawn(GetPlayerVehicleID(playerid)); return 1; } } return 1; } public OnPlayerStateChange(playerid, newstate, oldstate) { if (newstate == PLAYER_STATE_DRIVER && oldstate == PLAYER_STATE_ONFOOT) { new vehicleid=GetPlayerVehicleID(playerid); if(vehicleid == Vehicle[0] ||vehicleid == Vehicle[1] ||vehicleid == Vehicle[2] ||vehicleid == Vehicle[3] ||vehicleid == Vehicle[4] ||vehicleid == Vehicle[5] ||vehicleid == Vehicle[6] ||vehicleid == Vehicle[7] ||vehicleid == Vehicle[8] ||vehicleid == Vehicle[9]) { if(InRent[playerid] == 1) { return 1; } else { SendClientMessage(playerid, BLUE, "This Vehicle is a rental. Type /rentcar to rent this Vehicle. (Cost: $500)"); SendClientMessage(playerid, BLUE, "Type /exitrentcar to choose not to rent this Vehicle."); TogglePlayerControllable(playerid,0); InVehicle[playerid] = 1; return 1; } } } return 1; } public OnPlayerExitVehicle(playerid, vehicleid) { if(InRent[playerid] == 1) { lastvehicle[vehicleid] = playerid; SetTimer("tornoVehicle", 600000, 0); SendClientMessage(playerid, RED, "Return to the vehicle within 10 minutes, or it will be automatically returned."); return 1; } return 1; } forward tornoVehicle(playerid, vehicleid); public tornoVehicle(playerid, vehicleid) { GetPlayerVehicleID(playerid); if(vehicleid == Vehicle[0] ||vehicleid == Vehicle[1] ||vehicleid == Vehicle[2] ||vehicleid == Vehicle[3] ||vehicleid == Vehicle[4] ||vehicleid == Vehicle[5] ||vehicleid == Vehicle[6] ||vehicleid == Vehicle[7] ||vehicleid == Vehicle[8] ||vehicleid == Vehicle[9]) { SendClientMessage(playerid, BLUE, "You returned to the rental vehicle."); } else { SetVehicleToRespawn(lastvehicle[playerid]); SendClientMessage(playerid, RED, "You abandoned the rental vehicle."); } return 1; }