Pawno keeps on crashing
#1

Hello all! I am currently making a FS-Menu for my gamemode, but pawno just crashes. (well, i get that windows error, i click ''close the program'' and it just minimizes, it does not exit pawno)

Here is my pastebin, fyi, i have Vista.
http://pastebin.com/m6d69cc5f

I guess sorry for the noobish writing of the FS, but eh, w/e, everyone has to start somewhere. Probably a simple thing to fix

Thanks in advance!
Reply
#2

This is your filterscript, It could be caused by the simplest code,
Mostly caused by SpawnMenu in the wrong place,
Nothing to do with your OS,
Reply
#3

pawn Код:
new Menu:CurrentMenu = GetPlayerMenu(playerid);
That should be in the "OnPlayerSelectedMenuRow" callback ^^.

pawn Код:
GivePlayerMoney(playerid, -750);
      else
            {
            SendClientMessage(playerid, 0xFFFFFFFF, "You don't have enough money for this item!");
    }
"else" to what, you have no other statement. Get rid of all these lines:

pawn Код:
else
            {
            SendClientMessage(playerid, 0xFFFFFFFF, "You don't have enough money for this item!");
Then after the last case (6) put this:

pawn Код:
default : SendClientMessage(playerid, 0xFFFFFFFF, "You don't have enough money for this item!");
The above line is for anything which isn't a listed case (anything not 0 to 6), if you need more info about switch statements then consult the Wiki or Pawn_Lang.pdf.
Reply
#4

Thanks alot Donny! Now it doesnt crash, but now i get these errors:

Код:
C:\Users\Joop\Documents\Bas\server\samp\filterscripts\menu.pwn(36) : warning 217: loose indentation
C:\Users\Joop\Documents\Bas\server\samp\filterscripts\menu.pwn(141) : warning 217: loose indentation
C:\Users\Joop\Documents\Bas\server\samp\filterscripts\menu.pwn(141) : error 014: invalid statement; not in switch
C:\Users\Joop\Documents\Bas\server\samp\filterscripts\menu.pwn(141) : error 029: invalid expression, assumed zero
C:\Users\Joop\Documents\Bas\server\samp\filterscripts\menu.pwn(148) : error 029: invalid expression, assumed zero
C:\Users\Joop\Documents\Bas\server\samp\filterscripts\menu.pwn(148) : error 004: function "OnPlayerCommandText" is not implemented
C:\Users\Joop\Documents\Bas\server\samp\filterscripts\menu.pwn(150) : error 017: undefined symbol "cmdtext"
C:\Users\Joop\Documents\Bas\server\samp\filterscripts\menu.pwn(156) : warning 217: loose indentation
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


5 Errors.
Could you please check it out?
http://pastebin.com/m1554a1e0
Reply
#5

No problem.

You need to put the default outside of the last case so it goes like:

pawn Код:
case 6 :
{
  //some code
}
default : //some code
Also your OnPlayerCommandText has a rogue "}", get rid of the one above the return.
Reply
#6

O god, i really feel like a noob now. Thanks again Donny, but when i remove the ''}'' above ''return 0;'' , i still get 4 errors.

Here are the errors, and the pastebin.
http://pastebin.com/m628af1f

Errors:
Код:
C:\Users\Joop\Documents\Bas\server\samp\filterscripts\menu.pwn(36) : warning 217: loose indentation
C:\Users\Joop\Documents\Bas\server\samp\filterscripts\menu.pwn(121) : error 029: invalid expression, assumed zero
C:\Users\Joop\Documents\Bas\server\samp\filterscripts\menu.pwn(121) : error 004: function "OnPlayerCommandText" is not implemented
C:\Users\Joop\Documents\Bas\server\samp\filterscripts\menu.pwn(123) : error 017: undefined symbol "cmdtext"
C:\Users\Joop\Documents\Bas\server\samp\filterscripts\menu.pwn(129) : warning 217: loose indentation
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
Its something with that OnPlayerCommandText, how can it say that its not implemented btw?
Thanks in advance
Reply
#7

To get rid of warning 217, you must indentate your code, like this:
Код:
public OnFilterScriptInit()
{
  code();
}
not like
Код:
public OnFilterScriptInit()
{
code();
}
Indentation means when there is an opening bracket, next line must move on by 4 spaces (in PAWNcc default is 8, yet it is defined to 4 in a_samp.inc). You can generate that by pressing TAB.

You get the errors at line 121 because you don't close OnPlayerSelectedMenuRow properly, you do this:
Код:
public OnPlayerSelectedMenuRow(playerid, row)
{
new Menu:CurrentMenu = GetPlayerMenu(playerid);
if(CurrentMenu == shop)
{
  switch(row)
  {
    // cases here
    }
    return 1;
}
Indentation plays a big role, so you could see what is wrong.
You miss a } (closing bracket).
Код:
public OnPlayerSelectedMenuRow(playerid, row)
{
  new Menu:CurrentMenu = GetPlayerMenu(playerid);
  if(CurrentMenu == shop)
  {
    switch(row)
    {
      // cases here
    }
    return 1;
  }
That is how the compiler reads it, which puts OnPlayerCommandText into previous callback...
Reply
#8

Ok, i dont get any errors anymore (thanks alot ZaZa!), but it does not work properly ingame.
2 things:
1. It just sets the money to -amount, and it does not give the ''you dont have enough money for this item'' error, what it normally should give.
2. I dont get the item (i dont get any of the weapons, or the camouflage)

Pastebin:
http://pastebin.com/m2c4945fd

You guys are really friendly and helpfull
Reply
#9

Bump. The money and the weapon thing is fixed, but the object not. When i choose a camouflage, it just doesnt work. :/

Pastebin:
http://pastebin.com/m7bcf11f5

Sorry for the doublepost, btw.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)