PDA

View Full Version : Compiling my script doesn't show any output


Sellize
22/03/2015, 10:23 AM
When I compile it freezes for a few seconds and then it shows this

http://i.imgur.com/9Q1OGRB.png

CalvinC
22/03/2015, 10:30 AM
What were you doing before trying to compile it?
There might be something wrong with that script.

Gammix
22/03/2015, 10:31 AM
I will link to my previous post which maybe an appropriate answer to this.
http://forum.sa-mp.com/showpost.php?p=3375393&postcount=6

Sellize
22/03/2015, 10:33 AM
What were you doing before trying to compile it?
There might be something wrong with that script.

This has been happening just after I started working on a moneybag system, this is what I added:

http://pastebin.com/p7jDnDCn

I also added a moneybag variable to my players enum to save it with y_ini but there can't be anything wrong with that since I did them all the same and they work fine

fuckingcruse
22/03/2015, 10:35 AM
It doesn't stuck , if your script has more coding , then it takes time for reading and giving out the result , compliling :)

CalvinC
22/03/2015, 10:38 AM
forward createMBag(x, y, z, position[]);
public createMBag();
Should be
forward createMBag(Float:x, Float:y, Float:z, position[]);
public createMBag(Float:x, Float:y, Float:z, position[])
First, you didn't add parameters to the public, only the forward.
Second, you need to use floats for coordinates, or numbers that has decimals, and as well i removed the semicolon.

EDIT: Same with the MoneyBag public you created, remove the semicolon, only the forward needs it.

Sellize
22/03/2015, 05:46 PM
forward createMBag(x, y, z, position[]);
public createMBag();
Should be
forward createMBag(Float:x, Float:y, Float:z, position[]);
public createMBag(Float:x, Float:y, Float:z, position[])
First, you didn't add parameters to the public, only the forward.
Second, you need to use floats for coordinates, or numbers that has decimals, and as well i removed the semicolon.

EDIT: Same with the MoneyBag public you created, remove the semicolon, only the forward needs it.

I thought that was the problem when I read your reply, but after I fixed it it still won't compile.

Evocator
22/03/2015, 07:27 PM
Many problems:


new mBag = 0;
new mBagLoc[50] = "Nowhere";
new mBagPickup;

public OnGameModeInit()
{
Moneybag();
return 1;
}

forward Moneybag();
public Moneybag()
{
new
pos = random(42)
;

if (pos <= 5)
{
switch (pos)
{
case 0: createMBag(265.6487,2561.8484,16.3672, "Abandoned Airport");
case 1: createMBag(185.7434,2548.7910,16.5096, "Abandoned Airport");
}
}
return 1;
}

forward createMBag(x, y, z, position[]);
public createMBag(x, y, z, position[])
{
new string[128];
mBagPickup = CreatePickup(1550, 2, x, y, z, 0);
strmid(mBagLoc, position, 0, strlen(position), sizeof (position));
format(string, sizeof(string), "{3B7A57}[{A4C639}MoneyBag{3B7A57}] {568203}The moneybag has been hidden at {87A96B}%s{568203}! Find it for a reward.", mBagLoc);
return 1;
}

Sellize
23/03/2015, 04:22 PM
Many problems:


new mBag = 0;
new mBagLoc[50] = "Nowhere";
new mBagPickup;

public OnGameModeInit()
{
Moneybag();
return 1;
}

forward Moneybag();
public Moneybag()
{
new
pos = random(42)
;

if (pos <= 5)
{
switch (pos)
{
case 0: createMBag(265.6487,2561.8484,16.3672, "Abandoned Airport");
case 1: createMBag(185.7434,2548.7910,16.5096, "Abandoned Airport");
}
}
return 1;
}

forward createMBag(x, y, z, position[]);
public createMBag(x, y, z, position[])
{
new string[128];
mBagPickup = CreatePickup(1550, 2, x, y, z, 0);
strmid(mBagLoc, position, 0, strlen(position), sizeof (position));
format(string, sizeof(string), "{3B7A57}[{A4C639}MoneyBag{3B7A57}] {568203}The moneybag has been hidden at {87A96B}%s{568203}! Find it for a reward.", mBagLoc);
return 1;
}


Most things you pointed out are just things to simplify my code and do not fix any errors that haven't been shown before.

That being said, the script still doesn't compile.

De4dpOol
23/03/2015, 04:30 PM
Increase the length of string. It happened to me before because of this. However, there can be other things causing this.

Sellize
23/03/2015, 04:32 PM
Okay I commented certain pieces of code and the problem causer is definitely this piece of code:

forward createMBag(Float:x, Float:y, Float:z, position[]);
public createMBag(Float:x, Float:y, Float:z, position[])
{
new string[128];
mBagPickup = CreatePickup(1550, 2, x, y, z, 0);
strmid(mBagLoc, position, 0, strlen(position), sizeof (position));
format(string, sizeof(string), "{3B7A57}[{A4C639}MoneyBag{3B7A57}] {568203}The moneybag has been hidden at {87A96B}%s{568203}! Find it for a reward.", mBagLoc);
return 1;
}

Can anyone help? It's propably a missing bracket or something but I can't find it

arakuta
23/03/2015, 04:37 PM
Your code compile fine, the problem probably is in createMBag function.

Sellize
23/03/2015, 04:39 PM
Your code compile fine, the problem probably is in createMBag function.

Yes, but I've asked alot of people and nobody can figure out what's wrong with it

But it's definitely in Moneybag(); function because without it it compiles fine

BleverCastard
23/03/2015, 04:42 PM
My mate had this problem before. When it froze like yours does, he left it for about 30 seconds and it responded and compiled.

Sellize
23/03/2015, 04:44 PM
My mate had this problem before. When it froze like yours does, he left it for about 30 seconds and it responded and compiled.

Gonna leave it open now and see...

Some time later: still not compiled.

Extra info: it says it has compiled on the lower left of the screen but the .AMX file is 0kb

Sellize
23/03/2015, 05:19 PM
I fixed it. The problem was that I had a variable named Moneybag and a function.

BleverCastard
23/03/2015, 05:22 PM
I fixed it. The problem was that I had a variable named Moneybag and a function.

Glad I could help. Always try to troubleshoot your code as much as possible ;)