• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] error 017: undefined symbol
#1
Hello everyone! i have the following problem. I have been translating a GM into Spanish, I have only touched the names of the commands and the messages that users see. When I finished translating it (after several days) I compiled the gm and I got this error?with the commands that I had translated (before it did not give any error)



Code:
error 017: undefined symbol "cmd_colgar"

error 017: undefined symbol "cmd_colgar"//This is an example of one of them but it goes through more than 26 different commands.



It happens in any part of the code, regardless of the position where they are, they all give the same error. Does anyone know why? Thanks a lot.
  Reply
#2
(2021-03-13, 08:41 PM)Boxi Wrote: Hello everyone! i have the following problem. I have been translating a GM into Spanish, I have only touched the names of the commands and the messages that users see. When I finished translating it (after several days) I compiled the gm and I got this error?with the commands that I had translated (before it did not give any error)



Code:
error 017: undefined symbol "cmd_colgar"

error 017: undefined symbol "cmd_colgar"//This is an example of one of them but it goes through more than 26 different commands.



It happens in any part of the code, regardless of the position where they are, they all give the same error. Does anyone know why? Thanks a lot.



Are there other parts of the code calling the commands? If so, check that the calling code has the correct command name.
  Reply
#3
(2021-03-13, 09:06 PM)RhaegarX Wrote:
(2021-03-13, 08:41 PM)Boxi Wrote: Hello everyone! i have the following problem. I have been translating a GM into Spanish, I have only touched the names of the commands and the messages that users see. When I finished translating it (after several days) I compiled the gm and I got this error?with the commands that I had translated (before it did not give any error)



Code:
error 017: undefined symbol "cmd_colgar"

error 017: undefined symbol "cmd_colgar"//This is an example of one of them but it goes through more than 26 different commands.



It happens in any part of the code, regardless of the position where they are, they all give the same error. Does anyone know why? Thanks a lot.



Are there other parts of the code calling the commands? If so, check that the calling code has the correct command name.



Some yes, others no. Check that all the names were the same. But it keeps giving error, I don't understand why.
  Reply
#4
Which command processor does the gm use?

If it is dcmd, you should also change the command name in OnPlayerCommandText.

Also, in some parts of the script, this command may be called this way:
PHP Code:
MyFunction(playerid) {
    return 
cmd_colgar(playerid"");

You should rename it to the new name.
  Reply
#5
!) Can you show the code?



2) You should never call commands directly.
  Reply
#6
(2021-03-13, 10:05 PM)Radical Wrote: Which command processor does the gm use?



If it is dcmd, you should also change the command name in OnPlayerCommandText.



Also, in some parts of the script, this command may be called this way:

PHP Code:
MyFunction(playerid) {

? ? return 
cmd_colgar(playerid"");



You should rename it to the new name.



I'm using zcmd, some commands do have that, but check the name multiple times and it remains the same.
  Reply
#7
(2021-03-13, 10:37 PM)Y_Less Wrote: !) Can you show the code?



2) You should never call commands directly.



Well, this is the part of the code where the 26 errors occur, but it happens wherever I have the "cmd_" it is really something very disconcerting that this would happen just by changing the words.



Code:
forward OnPlayerUseItem(playerid, itemid, name[]);

public OnPlayerUseItem(playerid, itemid, name[])

{

? ? if (IsFurnitureItem(name))

{

? ? ? ? new id = House_Inside(playerid);



? ? ? ? if (id == -1)

? ? ? ? ? ? return SendErrorMessage(playerid, "Debes estar dentro de una casa para colocar muebles.");



if (!House_IsOwner(playerid, id))

? ? return SendErrorMessage(playerid, "Solo puedes colocar muebles en tu propia casa.");



static

? ? Float:x,

? ? Float:y,

? ? Float:z,

? ? Float:angle;



? ? ? ? GetPlayerPos(playerid, x, y, z);

? ? ? ? GetPlayerFacingAngle(playerid, angle);



? ? ? ? x = 5.0 * floatsin(-angle, degrees);

? ? ? ? y = 5.0 * floatcos(-angle, degrees);



if (Furniture_GetCount(id) > MAX_HOUSE_FURNITURE)

? ? return SendErrorMessage(playerid, "Solo puedes tener %d muebles en tu casa.", MAX_HOUSE_FURNITURE);



new furniture = Furniture_Add(id, name, InventoryData[playerid][itemid][invModel], x, y, z, 0.0, 0.0, angle);



if (furniture == -1)

? ? return SendErrorMessage(playerid, "El servidor ha alcanzado el l?mite de mobiliario.");



Inventory_Remove(playerid, name);

PlayerData[playerid][pEditFurniture] = furniture;



SendNearbyMessage(playerid, 30.0, COLOR_PURPLE, "** %s ha desplegado su \"%s\".", ReturnName(playerid, 0), name);

EditDynamicObject(playerid, FurnitureData[furniture][furnitureObject]);

}

else if (!strcmp(name, "Cargador", true)) {

? ? cmd_usarcarg(playerid, "\1");

}

else if (!strcmp(name, "Boombox", true)) {

? ? cmd_boombox(playerid, "lugar");

}

else if (!strcmp(name, "Mochila", true)) {

? ? cmd_mochila(playerid, "\1");

}

else if (!strcmp(name, "Primeros auxilios", true)) {

? ? ? ? cmd_utikit(playerid, "\1");

? ? }

? ? else if (!strcmp(name, "Tel?fono", true)) {

? ? ? ? cmd_telefono(playerid, "\1");

? ? }

? ? else if (!strcmp(name, "Radio portatil", true)) {

? ? ? ? SendSyntaxMessage(playerid, "Use \"/pr [text]\" para charlar con tu radio.");

? ? }

? ? else if (!strcmp(name, "Lata de combustible", true)) {

? ? ? ? cmd_llenar(playerid, "\1");

? ? }

? ? else if (!strcmp(name, "Kit de reparacion", true)) {

? ? ? ? cmd_reparar(playerid, "\1");

? ? }

? ? else if (!strcmp(name, "Recipiente NOS", true)) {

? ? ? ? cmd_nitro(playerid, "\1");

? ? }

? ? else if (!strcmp(name, "Lata de aerosol", true)) {

? ? ? ? cmd_pintar(playerid, "\1");

? ? }

? ? else if (!strcmp(name, "Sistema GPS", true)) {

? ? ? ? cmd_gps(playerid, "\1");

? ? }

? ? else if (!strcmp(name, "Marihuana", true)) {

? ? ? ? cmd_usardr(playerid, "Marihuana");

? ? }

? ? else if (!strcmp(name, "Cocaina", true)) {

? ? ? ? cmd_usardr(playerid, "cocaina");

? ? }

? ? else if (!strcmp(name, "Heroina", true)) {

? ? ? ? cmd_usardr(playerid, "heroina");

? ? }

? ? else if (!strcmp(name, "Esteroides", true)) {

? ? ? ? cmd_usardr(playerid, "Esteroides");

? ? }

? ? else if (!strcmp(name, "Soda", true)) {

? ? ? ? cmd_beber(playerid, "soda");

? ? }

? ? else if (!strcmp(name, "Botella de agua", true)) {

? ? ? ? cmd_beber(playerid, "agua");

? ? }

? ? else if (!strcmp(name, "Pizza congelada", true)) {

? ? ? ? cmd_cocinar(playerid, "pizza");

? ? }

? ? else if (!strcmp(name, "Hamburguesa congelada", true)) {

? ? ? ? cmd_cocinar(playerid, "hamburguesa");

? ? }

? ? else if (!strcmp(name, "Chaleco blindado", true)) {

? ? ? ? cmd_chaleco(playerid, "\1");

? ? }

? ? else if (!strcmp(name, "Ammo Cartridge", true)) {

? ? ? ? cmd_municion(playerid, "\1");

? ? }

? ? else if (!strcmp(name, "Colt 45", true)) {

? ? ? ? EquipWeapon(playerid, "Colt 45");

? ? }

? ? else if (!strcmp(name, "Desert Eagle", true)) {

? ? ? ? EquipWeapon(playerid, "Desert Eagle");

? ? }

? ? else if (!strcmp(name, "Escopeta", true)) {

? ? ? ? EquipWeapon(playerid, "Escopeta");

? ? }

? ? else if (!strcmp(name, "Micro SMG", true)) {

? ? ? ? EquipWeapon(playerid, "Micro SMG");

? ? }

? ? else if (!strcmp(name, "Tec-9", true)) {

? ? ? ? EquipWeapon(playerid, "Tec-9");

? ? }

? ? else if (!strcmp(name, "MP5", true)) {

? ? ? ? EquipWeapon(playerid, "MP5");

? ? }

? ? else if (!strcmp(name, "AK-47", true)) {

? ? ? ? EquipWeapon(playerid, "AK-47");

? ? }

? ? else if (!strcmp(name, "M4", true)) {

? ? ? ? EquipWeapon(playerid, "M4");

? ? }

? ? else if (!strcmp(name, "Rifle", true)) {

? ? ? ? EquipWeapon(playerid, "Rifle");

? ? }

? ? else if (!strcmp(name, "Sniper", true)) {

? ? ? ? EquipWeapon(playerid, "Sniper");

? ? }

? ? else if (!strcmp(name, "Palo de golf", true)) {

? ? ? ? EquipWeapon(playerid, "Palo de golf");

? ? }

? ? else if (!strcmp(name, "Cuchillo", true)) {

? ? ? ? EquipWeapon(playerid, "Cuchillo");

? ? }

? ? else if (!strcmp(name, "Pala", true)) {

? ? ? ? EquipWeapon(playerid, "Pala");

? ? }

? ? else if (!strcmp(name, "Katana", true)) {

? ? ? ? EquipWeapon(playerid, "Katana");

? ? }

? ? else if (!strcmp(name, "Semillas de marihuana", true)) {

? ? ? ? cmd_plantar(playerid, "Marihuana");

? ? }

? ? else if (!strcmp(name, "Semillas de cocaina", true)) {

? ? ? ? cmd_plantar(playerid, "Cocaina");

? ? }

? ? else if (!strcmp(name, "Semillas de heroina opio", true)) {

? ? ? ? cmd_plantar(playerid, "Heroina");

? ? }

? ? else if (!strcmp(name, "Palanca", true)) {

? ? ? ? cmd_palanca(playerid, "Palanca");

? ? }

? ? else if (!strcmp(name, "Destornillador", true)) {

? ? ? ? cmd_destornillador(playerid, "Destornillador");

? ? }

? ? else if (!strcmp(name, "Pizza cocida", true))

{

? ? ? ? if (PlayerData[playerid][pHunger] > 90)

? ? ? ? ? ? return SendErrorMessage(playerid, "No tienes hambre ahora mismo.");



? ? ? ? if (!IsPlayerAttachedObjectSlotUsed(playerid, 4))

{

? ? SetPlayerAttachedObject(playerid, 4, 2702, 6, 0.173041, 0.049197, 0.056789, 0.000000, 274.166107, 299.057983, 1.000000, 1.000000, 1.000000);

SetTimerEx("RemoveAttachedObject", 3000, false, "dd", playerid, 4);

}

? ? ? ? PlayerData[playerid][pHunger] = (PlayerData[playerid][pHunger]  15 > 100) ? (100) : (PlayerData[playerid][pHunger]  15);

Inventory_Remove(playerid, "Pizza cocida");



ApplyAnimation(playerid, "FOOD", "EAT_Burger", 4.1, 0, 0, 0, 0, 0, 1);

? ? ? ? SendNearbyMessage(playerid, 30.0, COLOR_PURPLE, "** %s toma una rebanada de pizza y se la come.", ReturnName(playerid, 0));

? ? }

? ? else if (!strcmp(name, "Hamburguesa cocida", true))

{

? ? if (PlayerData[playerid][pHunger] > 90)

? ? ? ? ? ? return SendErrorMessage(playerid, "No tienes hambre ahora mismo.");



if (!IsPlayerAttachedObjectSlotUsed(playerid, 4))

{

? ? SetPlayerAttachedObject(playerid, 4, 2703, 6, 0.078287, 0.019677, -0.001004, 0.000000, 0.000000, 0.000000, 1.000000, 1.000000, 1.000000);

SetTimerEx("RemoveAttachedObject", 3000, false, "dd", playerid, 4);

}

? ? ? ? PlayerData[playerid][pHunger] = (PlayerData[playerid][pHunger]  20 > 100) ? (100) : (PlayerData[playerid][pHunger]  20);

Inventory_Remove(playerid, "Hamburguesa cocida");



ApplyAnimation(playerid, "FOOD", "EAT_Burger", 4.1, 0, 0, 0, 0, 0, 1);

? ? ? ? SendNearbyMessage(playerid, 30.0, COLOR_PURPLE, "** %s hace una hamburguesa cocida y se la come.", ReturnName(playerid, 0));

? ? }

? ? else if (!strcmp(name, "Pollo", true))

{

? ? if (PlayerData[playerid][pHunger] > 90)

? ? ? ? ? ? return SendErrorMessage(playerid, "No tienes hambre ahora mismo.");



? ? ? ? PlayerData[playerid][pHunger] = (PlayerData[playerid][pHunger]  25 > 100) ? (100) : (PlayerData[playerid][pHunger]  25);

Inventory_Remove(playerid, "Pollo");



ApplyAnimation(playerid, "VENDING", "VEND_Eat_P", 4.1, 0, 0, 0, 0, 0, 1);

? ? ? ? SendNearbyMessage(playerid, 30.0, COLOR_PURPLE, "** %s toma un trozo de pollo y se lo come.", ReturnName(playerid, 0));

? ? }

? ? return 1;

}
  Reply
#8
One of the possibilities could be that you accidentally removed { or } in the gamemode. 26 errors also show when you are missing them. You can try checking if you are missing one. You can do this quickly if you are using Firefox browser. Make a copy of the gamemode. Paste it on your desktop. Open the copied gamemode with Firefox and press Ctrl and put in { to search for. At the bottom it should show how many matches it found. After you see the number of the { matches, search for } and then check if the match numbers are the same. If they are not the same that means you are missing { or } somewhere in your code.
  Reply
#9
You can do that in an editor, you don't need a browser. But if the code is properly indented it should be obvious where the missing brace is.
  Reply
#10
(2021-03-14, 01:06 AM)Virsenas Wrote:

One of the possibilities could be that you accidentally removed { or } in the gamemode. 26 errors also show when you are missing them. You can try checking if you are missing one. You can do this quickly if you are using Firefox browser. Make a copy of the gamemode. Paste it on your desktop. Open the copied gamemode with Firefox and press Ctrl and put in { to search for. At the bottom it should show how many matches it found. After you see the number of the { matches, search for } and then check if the match numbers are the same. If they are not the same that means you are missing { or } somewhere in your code.





(2021-03-14, 02:08 AM)Y_Less Wrote: You can do that in an editor, you don't need a browser.? But if the code is properly indented it should be obvious where the missing brace is.



I tried to do it the first way with Firefox but when I searched it said "more than 1000 matches" then I thought of using Notepad and I got the following: (the result of the matches is in blue letters)?



[Image: PcSfMPQ.png]



[Image: 6xPhq6P.png]



Are 5 differences. Is this the problem?



Edit: And if so, is there any way to find those keys faster, so as not to go through the whole code again. Thanks for your answers :'D
  Reply
#11
Yes, that's exactly the problem (probably, there are cases where it isn't, but they're rare). As I said, indent your code. Or you can revert to an earlier commit and redo the changes.
  Reply
#12
(2021-03-14, 02:08 AM)Y_Less Wrote: You can do that in an editor, you don't need a browser. But if the code is properly indented it should be obvious where the missing brace is.



I know. I just dismissed the hassle of downloading and installing an editor. I just wanted to at least know if he is missing any. If he is missing some brackets, then he can download and install an editor that actually shows where he is missing the brackets.



(2021-03-14, 03:41 AM)Boxi Wrote:
(2021-03-14, 01:06 AM)Virsenas Wrote:

One of the possibilities could be that you accidentally removed { or } in the gamemode. 26 errors also show when you are missing them. You can try checking if you are missing one. You can do this quickly if you are using Firefox browser. Make a copy of the gamemode. Paste it on your desktop. Open the copied gamemode with Firefox and press Ctrl and put in { to search for. At the bottom it should show how many matches it found. After you see the number of the { matches, search for } and then check if the match numbers are the same. If they are not the same that means you are missing { or } somewhere in your code.





(2021-03-14, 02:08 AM)Y_Less Wrote: You can do that in an editor, you don't need a browser.? But if the code is properly indented it should be obvious where the missing brace is.



I tried to do it the first way with Firefox but when I searched it said "more than 1000 matches" then I thought of using Notepad and I got the following: (the result of the matches is in blue letters)?



[Image: PcSfMPQ.png]



[Image: 6xPhq6P.png]



Are 5 differences. Is this the problem?



Edit: And if so, is there any way to find those keys faster, so as not to go through the whole code again. Thanks for your answers :'D



Yes. The numbers have to be the same. I would just keep deleting parts of the gamemode and keep checking if the difference is still the same. I would probably first delete half of the gamemode and then check if the difference is the same. If it's the same, that means the deleted part of the code did not have a missing or an extra bracket. If you delete a part of the code and you see a change in the difference of the number then you can undo the deletion of the code and paste it in another empty file and keep deleting parts of that code also. But that's just me. You can try other things to help you with the missing brackets.



A few years ago I did have a tool that checked the curly brackets exactly for .pwn files. Someone in the sa-mp community I think created that tool. You would just drop the .pwn file on the tool. Then it would scan the file. It would show the number of opened and closed brackets and it would show the line at which the opened bracket is missing a closed bracket which either means it is actually missing a curly bracket or you have an extra one which was mentioned in the tool on that exact line. I'll try to dig up more and see if I can find it again.
  Reply
#13
(2021-03-14, 11:45 AM)Y_Less Wrote: Yes, that's exactly the problem (probably, there are cases where it isn't, but they're rare).? As I said, indent your code.? Or you can revert to an earlier commit and redo the changes.



I understand, I will try to look for those brackets. Otherwise I'll have to start translating again :P



Quote:Yes. The numbers have to be the same. I would just keep deleting parts of the gamemode and keep checking if the difference is still the same. I would probably first delete half of the gamemode and then check if the difference is the same. If it's the same, that means the deleted part of the code did not have a missing or an extra bracket. If you delete a part of the code and you see a change in the difference of the number then you can undo the deletion of the code and paste it in another empty file and keep deleting parts of that code also. But that's just me. You can try other things to help you with the missing brackets.



A few years ago I did have a tool that checked the curly brackets exactly for .pwn files. Someone in the sa-mp community I think created that tool. You would just drop the .pwn file on the tool. Then it would scan the file. It would show the number of opened and closed brackets and it would show the line at which the opened bracket is missing a closed bracket which either means it is actually missing a curly bracket or you have an extra one which was mentioned in the tool on that exact line. I'll try to dig up more and see if I can find it again.



That's a very good idea! I will try to do that. Although if you find that tool I would really appreciate it if you could pass it on to me.



Again, thank you very much for responding, you have really helped me a lot. I had no idea how to solve this problem.
  Reply


Forum Jump: