[Ajuda] fatal error 100: cannot read from file: "strtok"
#1

Alguem pode me explicar porque isso acontece e como resolvo?
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;
}
Reply
#2

strtok nгo й include
use no final do gamemode ou filterscript
Код:
strtok(const string[], &index)			  //   Faster strtok Code by Jeffry  
{                                        
	new result[20], length = strlen(string), i = index;
	while ((i < length) && (string[i] == ' ')) i++;
	strmid(result,string,i,((index = strfind(string, " ", false, i)) == -1) ? (index = length) : (index) , 20);
	index++;
	return result;
}
ou
Код:
strtok(const string[], &index)
{
	new length = strlen(string);
	while ((index < length) && (string[index] <= ' '))
	{
		index++;
	}
	new offset = index, result[20];
	while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
	{
		result[index - offset] = string[index];
		index++;
	}
	result[index - offset] = EOS;
	return result;
}
Reply
#3

Quote:
Originally Posted by Kanuy
Посмотреть сообщение
strtok nгo й include
use no final do gamemode ou filterscript
Код:
strtok(const string[], &index)			  //   Faster strtok Code by Jeffry  
{                                        
	new result[20], length = strlen(string), i = index;
	while ((i < length) && (string[i] == ' ')) i++;
	strmid(result,string,i,((index = strfind(string, " ", false, i)) == -1) ? (index = length) : (index) , 20);
	index++;
	return result;
}
ou
Код:
strtok(const string[], &index)
{
	new length = strlen(string);
	while ((index < length) && (string[index] <= ' '))
	{
		index++;
	}
	new offset = index, result[20];
	while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
	{
		result[index - offset] = string[index];
		index++;
	}
	result[index - offset] = EOS;
	return result;
}
Entгo, acontece que quanto retiro #include <strtok> para adicionar um desses dois, que vocк citou.
Da isso:
Код:
C:\Users\Marcelo\Desktop\GM ATUAL\gamemodes\roleplay.pwn(1868) : error 017: undefined symbol "mysql_tquery"
C:\Users\Marcelo\Desktop\GM ATUAL\gamemodes\roleplay.pwn(1877) : error 017: undefined symbol "mysql_tquery"
C:\Users\Marcelo\Desktop\GM ATUAL\gamemodes\roleplay.pwn(1889) : error 017: undefined symbol "mysql_tquery"
C:\Users\Marcelo\Desktop\GM ATUAL\gamemodes\roleplay.pwn(1900) : warning 202: number of arguments does not match definition
C:\Users\Marcelo\Desktop\GM ATUAL\gamemodes\roleplay.pwn(1909) : error 017: undefined symbol "mysql_tquery"
C:\Users\Marcelo\Desktop\GM ATUAL\gamemodes\roleplay.pwn(1903) : warning 203: symbol is never used: "playerid"
C:\Users\Marcelo\Desktop\GM ATUAL\gamemodes\roleplay.pwn(2028) : error 017: undefined symbol "mysql_tquery"
C:\Users\Marcelo\Desktop\GM ATUAL\gamemodes\roleplay.pwn(2081) : error 017: undefined symbol "mysql_tquery"
C:\Users\Marcelo\Desktop\GM ATUAL\gamemodes\roleplay.pwn(2173) : error 017: undefined symbol "cache_affected_rows"
C:\Users\Marcelo\Desktop\GM ATUAL\gamemodes\roleplay.pwn(2229) : error 017: undefined symbol "cache_insert_id"
C:\Users\Marcelo\Desktop\GM ATUAL\gamemodes\roleplay.pwn(2235) : warning 235: public function lacks forward declaration (symbol "OnVehicleSirenStateChange")
C:\Users\Marcelo\Desktop\GM ATUAL\gamemodes\roleplay.pwn(2280) : warning 202: number of arguments does not match definition
C:\Users\Marcelo\Desktop\GM ATUAL\gamemodes\roleplay.pwn(2281) : warning 202: number of arguments does not match definition
C:\Users\Marcelo\Desktop\GM ATUAL\gamemodes\roleplay.pwn(2309) : warning 202: number of arguments does not match definition
C:\Users\Marcelo\Desktop\GM ATUAL\gamemodes\roleplay.pwn(3579) : error 017: undefined symbol "mysql_tquery"
C:\Users\Marcelo\Desktop\GM ATUAL\gamemodes\roleplay.pwn(3602) : error 017: undefined symbol "mysql_tquery"
C:\Users\Marcelo\Desktop\GM ATUAL\gamemodes\roleplay.pwn(3621) : error 017: undefined symbol "mysql_tquery"
C:\Users\Marcelo\Desktop\GM ATUAL\gamemodes\roleplay.pwn(3664) : error 017: undefined symbol "mysql_tquery"
C:\Users\Marcelo\Desktop\GM ATUAL\gamemodes\roleplay.pwn(3689) : error 017: undefined symbol "mysql_tquery"
C:\Users\Marcelo\Desktop\GM ATUAL\gamemodes\roleplay.pwn(3722) : error 017: undefined symbol "mysql_tquery"
C:\Users\Marcelo\Desktop\GM ATUAL\gamemodes\roleplay.pwn(4114) : error 017: undefined symbol "mysql_tquery"
C:\Users\Marcelo\Desktop\GM ATUAL\gamemodes\roleplay.pwn(4128) : error 017: undefined symbol "mysql_tquery"
C:\Users\Marcelo\Desktop\GM ATUAL\gamemodes\roleplay.pwn(4192) : error 017: undefined symbol "mysql_tquery"
C:\Users\Marcelo\Desktop\GM ATUAL\gamemodes\roleplay.pwn(4223) : error 017: undefined symbol "mysql_tquery"
C:\Users\Marcelo\Desktop\GM ATUAL\gamemodes\roleplay.pwn(4237) : error 017: undefined symbol "mysql_tquery"
C:\Users\Marcelo\Desktop\GM ATUAL\gamemodes\roleplay.pwn(4299) : error 017: undefined symbol "mysql_tquery"
C:\Users\Marcelo\Desktop\GM ATUAL\gamemodes\roleplay.pwn(4371) : error 017: undefined symbol "mysql_tquery"
C:\Users\Marcelo\Desktop\GM ATUAL\gamemodes\roleplay.pwn(4421) : error 017: undefined symbol "mysql_tquery"
C:\Users\Marcelo\Desktop\GM ATUAL\gamemodes\roleplay.pwn(4466) : error 017: undefined symbol "mysql_tquery"
C:\Users\Marcelo\Desktop\GM ATUAL\gamemodes\roleplay.pwn(4487) : error 017: undefined symbol "mysql_tquery"
C:\Users\Marcelo\Desktop\GM ATUAL\gamemodes\roleplay.pwn(4534) : error 017: undefined symbol "mysql_tquery"
C:\Users\Marcelo\Desktop\GM ATUAL\gamemodes\roleplay.pwn(4577) : error 017: undefined symbol "mysql_tquery"

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


26 Errors.
Reply
#4

26 erros geralmete й alguma chave que ficou aberta { }
Код:
if(..)
{
}// chave em falta
Veja se nгo apagou uma chave por engano
Reply
#5

Quote:
Originally Posted by Kanuy
Посмотреть сообщение
26 erros geralmete й alguma chave que ficou aberta { }
Код:
if(..)
{
}// chave em falta
Veja se nгo apagou uma chave por engano
Nгo, nгo apaguei, a gm era essa aqui
Mais й foda, nгo consigo arrumar o erro, mesmo que seje a chave aberta, й complicado localizar o local exato.
Mais valeu pela tentativa de ajuda mano. :v
Reply
#6

Veja:
https://sampforum.blast.hk/showthread.php?tid=361455
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)