error 036: empty statement
#1

I am working on making my own drug and weapon dealer mats and i wanted to use a 2 paramater command so in the end i decided to use sscanf. It works perfect except this error.

Quote:

C:\Program Files\Rockstar Games\GTA San andreas\gamemodes\personals.pwn(275) : error 036: empty statement
C:\Program Files\Rockstar Games\GTA San andreas\gamemodes\personals.pwn(276) : error 036: empty statement
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.

HERE ARE THE LINES, SIMPLY:
Quote:

dcmd(givedrugmats, 12, cmdtext);
dcmd(givewepmats, 11, cmdtext);

Also the command seems to work perfectly when i type only the /command but once i add the ammount it doesn't seem to pick it up. If you know how to fix this this i would appriciate it. I did add brackets
Quote:

{}

to fix it once but i dont think thats how i'm really supposed to do it.
Reply
#2

Show us your command code for "givedrugmats" and "givewepmats" as with dcmd, the code for 'dcmd(...);' is actually once compiled turned in to your command.
Reply
#3

Put that on OnPlayerCommandText and check if this is correct
pawn Код:
dcmd_givedrugmats(playerid, params[])
{
    return 1;
}
Reply
#4

The OP probably already has that... Let's just get his code so we can find the problem with it, instead of giving him more problems.
Reply
#5

Empty statement occurs when you have a semicolon somewhere it's not supposed to be. For example, this generates an empty statement error:

pawn Код:
vColor2{v} = color2;;
Reply
#6

Quote:
Originally Posted by __
Посмотреть сообщение
Show us your command code for "givedrugmats" and "givewepmats" as with dcmd, the code for 'dcmd(...);' is actually once compiled turned in to your command.
Here it is All of it.
Quote:

dcmd_givedrugmats(playerid, params[]){
new id, drugmatamount, idname[30];
if (sscanf(params, "ui", id, drugmatamount))SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/givedrugmats <playerid> <amount>\"");
else if (id == INVALID_PLAYER_ID) SendClientMessage(playerid, 0xFF0000AA, "Player not found");
else{
//=====GIVING STRING DRUG MATS=====
PlayerStats[id][PDrugMats] += drugmatamount;
new drugmats[30];
format(drugmats,sizeof(drugmats),"You recieved %i drug material(s).",drugmatamount);
SendClientMessage(id, 0x00FF00AA, drugmats);
new drugmats2[30];
format(drugmats2,sizeof(drugmats2),"You gave %s %i drug material(s).",GetPlayerName(id,idname,sizeof(idnam e)),drugmatamount);
SendClientMessage(playerid, 0x00FF00AA,drugmats2);
}
return 1;
}

//new WepNumber;

dcmd_givewepmats(playerid, params[]){
new id, wepmatamount, idname[30];
if (sscanf(params, "ui", id, wepmatamount))SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/givewepmats <playerid> <amount>\"");
else if (id == INVALID_PLAYER_ID) SendClientMessage(playerid, 0xFF0000AA, "Player not found");
else{
//=====GIVING STRING WEAPON MATS=====
PlayerStats[playerid][PWepMats] = wepmatamount;
new wepmats[30];
format(wepmats,sizeof(wepmats),"You recieved %i weapon material(s).",wepmatamount);
SendClientMessage(id, 0x00FF00AA, wepmats);
new wepmats2[30];
format(wepmats2,sizeof(wepmats2),"You gave %s %i weapon matierial(s).",GetPlayerName(id,idname,sizeof(idna me)),wepmatamount);
SendClientMessage(playerid, 0x00FF00AA, wepmats2);
}
return 1;
}


dcmd(givedrugmats, 12, cmdtext);
dcmd(givewepmats, 11, cmdtext);

If anyone knows why when i added the brackets as the other person stated it ran and it showed the first if, but the last else didn't show up when i entered the command correctly, any solution(never check the else if INVALID_PLAYER_ID command)?
Reply
#7

Quote:
Originally Posted by Lorenc_
Посмотреть сообщение
Put that on OnPlayerCommandText and check if this is correct
pawn Код:
dcmd_givedrugmats(playerid, params[])
{
    return 1;
}
it works without the return 1, return makes it into unreachable code error, but with just 2 empty brackets it runs but, same problem still when i enter the params correctly i get nothing when it is soppuse to send me message telling me how much mats i gave myself esc. The command should work on myself right? if i didn't make logic to make it not right?
Reply
#8

ahh, got it working this time thanks to everyone for suggestions. it ended up being just {} 2 empty brackets did the trick.

Quote:

!!SOLVED!!

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)