25.08.2016, 21:35
Alguem pode me explicar porque isso acontece e como resolvo?
O problema estб nesse comando
PS: #include <strtok> jб estб adicionado
O problema estб nesse comando
PS: #include <strtok> jб estб adicionado
Код:
CMD:bomb(playerid, params[]) { new idx, szParameters[2][128 - 6]; szParameters[0] = strtok(params, idx); if(isnull(szParameters[0])) { SendClientMessage(playerid, COLOR_GREY, "USAGE: /bomb [Parameter]"); SendClientMessage(playerid, COLOR_GREY, "Available parameters: {E6E6E6}put{AFAFAF}, {E6E6E6}activate{AFAFAF}"); if(PlayerData[playerid][pSwatMember]) { SendClientMessage(playerid, COLOR_FACTIONCHAT, "[SWAT]: {E6E6E6}check{AFAFAF}, {E6E6E6}disarm{AFAFAF}"); } return 1; } szParameters[1] = strtok(params, idx); if(!strcmp(szParameters[0], "put", true, 4)) { new BombTimerID = GetPVarInt(playerid, "PuttingBomb"), szSetting[20], iTimer; if(BombTimerID) { KillTimer(BombTimerID); DeletePVar(playerid, "PuttingBomb"); GameTextForPlayer(playerid, "~r~Stopped arming bomb", 2000, 3); TogglePlayerControllable(playerid, 1); return 1; } if (!Inventory_HasItem(playerid, "Bomb")) return SendErrorMessage(playerid, "You dont have a Bomb. Visit the blackmaret and buy one or contact an illegal member."); szSetting = strtok(params, idx); iTimer = strval(strtok(params, idx)); if(isnull(szParameters[1])) { SendClientMessage(playerid, COLOR_GREY, "USAGE: /bomb put [{E6E6E6}Vehicle ID{AFAFAF}] [{E6E6E6}Setting{AFAFAF}] [{E6E6E6}Timer (Seconds){AFAFAF}]"); SendClientMessage(playerid, COLOR_WHITE, "Available settings: {E6E6E6}Ignition, timer, speed, remote"), SendClientMessage(playerid, COLOR_GREY, "NOTE: Use \"{E6E6E6}/bomb put help{AFAFAF}\" for explinations of use."); return 1; } if(!strcmp(szParameters[1], "help", true, 5)) { SendClientMessage(playerid, COLOR_WHITE, "[ BOMB PUT MANUAL ]"); SendClientMessage(playerid, COLOR_WHITE, "Setting 1: IGNITION {AAAAAA}- Activates the bomb timer after the {E6E6E6}vehicle's ignition{AAAAAA} is activated."); SendClientMessage(playerid, COLOR_WHITE, "Setting 2: TIMER {AAAAAA}- {E6E6E6}Immediately{AAAAAA} activates the bomb timer."); SendClientMessage(playerid, COLOR_WHITE, "Setting 3: SPEED {AAAAAA}- The bomb will explode as soon as the {E6E6E6}vehicle speed{AAAAAA}"); SendClientMessage(playerid, COLOR_WHITE, "drops under {E6E6E6}40{AAAAAA} km/h. It is activated {E6E6E6}as soon as the vehicle is started{AAAAAA}."); SendClientMessage(playerid, COLOR_WHITE, "Setting 4: REMOTE {AAAAAA}- Bomb is activated with \"{E6E6E6}/bomb activate{AAAAAA}\". Note that the {E6E6E6}remote range is limited{AAAAAA}."); SendClientMessage(playerid, COLOR_WHITE, "The timer: {AAAAAA}- Decides how long it takes for the bomb to {E6E6E6}detonate{AAAAAA} from the moment it is activated."); SendClientMessage(playerid, COLOR_WHITE, "You can get the {E6E6E6}ID{AAAAAA} of the vehicle by using the \"{E6E6E6}/dl{AAAAAA}\" command."); SendClientMessage(playerid, COLOR_WHITE, "[ END OF BOMB PUT MANUAL ]"); return 1; } if( !GetVehicleModel( strval( szParameters[1] ) ) ) // The car isn't spawned { SendClientMessage(playerid, COLOR_GREY, "ERROR: Invalid vehicle ID."); SendClientMessage(playerid, COLOR_GREY, "TIP: You can use \"{E6E6E6}/dl{AFAFAF}\" to see the IDs of nearby vehicles."); return 1; } if(IsPlayerInAnyVehicle(playerid)) { SendClientMessage(playerid, COLOR_GREY, "ERROR: You need to stand close to the vehicle, not in it."); return 1; } new iVehicleID = strval(szParameters[1]), Float: f_Pos[3]; GetVehiclePos(iVehicleID, f_Pos[0], f_Pos[1], f_Pos[2]); if(!IsPlayerInRangeOfPoint(playerid, BOMB_USE_DISTANCE, f_Pos[0], f_Pos[1], f_Pos[2])) { SendClientMessage(playerid, COLOR_GREY, "ERROR: You are not close enough to this vehicle."); return 1; } new iSetting; if(!strcmp(szSetting, "ignition", true, 9)) { if(iTimer < 1 || iTimer > 60) { SendClientMessage(playerid, COLOR_GREY, "ERROR: Invalid timer input. Must be between {E6E6E6}1{AFAFAF} and {E6E6E6}60{AFAFAF} seconds."); return 1; } iSetting = VEHICLE_BOMB_TYPE_IGNITION; Inventory_Remove(playerid, "Bomb"); } else if(!strcmp(szSetting, "timer", true, 6)) { if(iTimer < 10 || iTimer > 120) { SendClientMessage(playerid, COLOR_GREY, "ERROR: Invalid timer input. Must be between {E6E6E6}10{AFAFAF} and {E6E6E6}120{AFAFAF} seconds."); return 1; } iSetting = VEHICLE_BOMB_TYPE_TIMER; Inventory_Remove(playerid, "Bomb"); } else if(!strcmp(szSetting, "speed", true, 6)) { if(iTimer < 15 || iTimer > 60) { SendClientMessage(playerid, COLOR_GREY, "ERROR: Invalid timer input. Must be between {E6E6E6}15{AFAFAF} and {E6E6E6}60{AFAFAF} seconds."); return 1; } iSetting = VEHICLE_BOMB_TYPE_SPEED; Inventory_Remove(playerid, "Bomb"); } else if(!strcmp(szSetting, "remote", true, 6)) { if(iTimer < 1 || iTimer > 60) { SendClientMessage(playerid, COLOR_GREY, "ERROR: Invalid timer input. Must be between {E6E6E6}1{AFAFAF} and {E6E6E6}60{AFAFAF} seconds."); return 1; } iSetting = VEHICLE_BOMB_TYPE_REMOTE; Inventory_Remove(playerid, "Bomb"); } else { SendClientMessage(playerid, COLOR_GREY, "ERROR: Invalid setting. Please refer to manual: \"{E6E6E6}/bomb put help{AFAFAF}\"."); return 1; } ResetBombInfo(iVehicleID); ApplyAnimation(playerid, "BOMBER", "BOM_Plant_Loop", 2.0, 0, 0, 0, 0, BOMB_ARMTIME * 1100, 0); SetPVarInt(playerid, "PuttingBomb", SetTimerEx("PlayerPutBombInVehicle", 0, 0, "ddddd", BOMB_ARMTIME, playerid, iVehicleID, iSetting, iTimer)); return 1; } if(!strcmp(szParameters[0], "activate", true, 4)) { new Float: f_vPos[3], iHasAnyRemoteBombs; for(new i; i < MAX_VEHICLES; i++) { if(g_Bomb_Vehicles[i][bv_i_ArmedType] == VEHICLE_BOMB_TYPE_REMOTE && g_Bomb_Vehicles[i][bv_i_BombOwner] == playerid) { iHasAnyRemoteBombs = 1; GetVehiclePos(i, f_vPos[0], f_vPos[1], f_vPos[2]); if(IsPlayerInRangeOfPoint(playerid, 100.0, f_vPos[0], f_vPos[1], f_vPos[2])) { g_Bomb_Vehicles[i][bv_i_BombOwner] = INVALID_PLAYER_ID; BombActivated(i); } } } if(!iHasAnyRemoteBombs) { SendClientMessage(playerid, COLOR_GREY, "ERROR: You haven't planted any bombs."); return 1; } new Float: f_Pos[3]; GetPlayerPos(playerid, f_Pos[0], f_Pos[1], f_Pos[2]); PlayerPlaySound(playerid, 6400, f_Pos[0], f_Pos[1], f_Pos[2]); SendClientMessage(playerid, COLOR_ORANGE, "You pressed the trigger on your remote to active your bomb(s)."); SendClientMessage(playerid, COLOR_GREY, "NOTE: The distance for the remote is limited."); return 1; } if(PlayerData[playerid][pSwatMember]) { if(!strcmp(szParameters[0], "check", true, 4)) { new BombCheckingTimerID = GetPVarInt(playerid, "CheckingForBombs"); if(BombCheckingTimerID) { KillTimer(BombCheckingTimerID); DeletePVar(playerid, "CheckingForBombs"); GameTextForPlayer(playerid, "~r~Stopped looking for bombs", 2000, 3); return 1; } if(GetPVarInt(playerid, "DisarmingBomb")) { SendClientMessage(playerid, COLOR_GREY, "You are busy disarming the bomb."); return 1; } if(isnull(szParameters[1])) { SendClientMessage(playerid, COLOR_GREY, "USAGE: /bomb check [Vehicle ID]"); return 1; } new iVehicleID = strval(szParameters[1]); if(!GetVehicleModel(iVehicleID)) { SendClientMessage(playerid, COLOR_GREY, "ERROR: Invalid vehicle ID."); SendClientMessage(playerid, COLOR_GREY, "TIP: You can use \"{E6E6E6}/dl{AFAFAF}\" to see the IDs of nearby vehicles."); return 1; } if(IsPlayerInAnyVehicle(playerid)) { SendClientMessage(playerid, COLOR_GREY, "ERROR: You need to stand close to the vehicle, not in it."); return 1; } new Float: f_vPos[3]; GetVehiclePos(iVehicleID, f_vPos[0], f_vPos[1], f_vPos[2]); if(!IsPlayerInRangeOfPoint(playerid, BOMB_USE_DISTANCE, f_vPos[0], f_vPos[1], f_vPos[2])) { SendClientMessage(playerid, COLOR_GREY, "You are not close enough to the vehicle."); return 1; } GameTextForPlayer(playerid, "~g~Checking for bombs... ~n~ ~y~Type ~r~/bomb check~y~ again to stop.", BOMB_CHECKTIME * 1100, 3); ApplyAnimation(playerid, "BOMBER", "BOM_Plant_Loop", 2.0, 0, 0, 0, 0, BOMB_CHECKTIME * 1100, 0); SetPVarInt(playerid, "CheckingForBombs", SetTimerEx("CheckForBombs", BOMB_CHECKTIME * 1000, 0, "dd", playerid, iVehicleID)); return 1; } if(!strcmp(szParameters[0], "disarm", true, 4)) { new DisarmingBombTimerID = GetPVarInt(playerid, "DisarmingBomb"); if(DisarmingBombTimerID) { KillTimer(DisarmingBombTimerID); DeletePVar(playerid, "DisarmingBomb"); GameTextForPlayer(playerid, "~r~Stopped disarming the bomb", 2000, 3); return 1; } if(GetPVarInt(playerid, "CheckingForBombs")) { SendClientMessage(playerid, COLOR_GREY, "You are busy checking for bombs."); return 1; } if(isnull(szParameters[1])) { SendClientMessage(playerid, COLOR_GREY, "USAGE: /bomb disarm [Vehicle ID]"); SendClientMessage(playerid, COLOR_GREY, "TIP: You can use \"{E6E6E6}/dl{AFAFAF}\" to see the IDs of nearby vehicles."); return 1; } new iVehicleID = strval(szParameters[1]); if(!GetVehicleModel(iVehicleID)) { SendClientMessage(playerid, COLOR_GREY, "ERROR: Invalid vehicle ID."); SendClientMessage(playerid, COLOR_GREY, "TIP: You can use \"{E6E6E6}/dl{AFAFAF}\" to see the IDs of nearby vehicles."); return 1; } if(IsPlayerInAnyVehicle(playerid)) { SendClientMessage(playerid, COLOR_GREY, "ERROR: You need to stand close to the vehicle, not in it."); return 1; } new Float: f_vPos[3]; GetVehiclePos(iVehicleID, f_vPos[0], f_vPos[1], f_vPos[2]); if(!IsPlayerInRangeOfPoint(playerid, BOMB_USE_DISTANCE, f_vPos[0], f_vPos[1], f_vPos[2])) { SendClientMessage(playerid, COLOR_GREY, "You are not close enough to the vehicle."); return 1; } if(GetPVarInt(playerid, "CheckedCarForBombs") != iVehicleID) { SendClientMessage(playerid, COLOR_GREY, "ERROR: You haven't checked this car for bombs yet, you need to see where it is first."); return 1; } if(GetPVarInt(playerid, "FoundBombInCar") != iVehicleID) { SendClientMessage(playerid, COLOR_GREY, "ERROR: You haven't found any bombs on this vehicle."); return 1; } GameTextForPlayer(playerid, "~g~Disarming bomb...~n~ ~y~Type ~r~/bomb disarm~y~ again to stop.", BOMB_DISARMTIME * 1000, 3); ApplyAnimation(playerid, "BOMBER", "BOM_Plant_Loop", 2.0, 0, 0, 0, 0, BOMB_DISARMTIME * 1100, 0); SetPVarInt(playerid, "DisarmingBomb", SetTimerEx("DisarmBomb", BOMB_DISARMTIME * 1000, 0, "dd", playerid, iVehicleID)); return 1; } } SendClientMessage(playerid, COLOR_GREY, "ERROR: Invalid parameter. For a full list of available parameters, type \"/bomb\"."); return 1; }