SA-MP Forums Archive
Help with 1ERROR! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help with 1ERROR! (/showthread.php?tid=396459)



Help with 1ERROR! - goviscrap - 01.12.2012

I have only 1 error and i need help...
here is the ERROR and Warnings:

Код:
C:\Users\Nicklas\Desktop\PRP\gamemodes\PRP.pwn(13861) : warning 202: number of arguments does not match definition
C:\Users\Nicklas\Desktop\PRP\gamemodes\PRP.pwn(13861) : error 036: empty statement
C:\Users\Nicklas\Desktop\PRP\gamemodes\PRP.pwn(13867) : warning 209: function "StreamScaryMusic" should return a value


1 Error.
And here is the code:
Код:
public StreamScaryMusic(playerid)
{
    if(IsPlayerConnected(playerid))
	{
		if(IsPlayerInRangeOfPoint(playerid,-2097.8840,2714.8054,163.9876));
		{
			PlayAudioStreamForPlayer(playerid,"http://205.196.120.224/1bdskxj5catg/ltnktunymuk/Free+Halloween+Music+mixed+by+MonsterPulse.mp3,20,1"); //Like this?
			return true;
		}
	}
}



Re: Help with 1ERROR! - JaKe Elite - 01.12.2012

pawn Код:
if(IsPlayerInRangeOfPoint(playerid,-2097.8840,2714.8054,163.9876));
to

pawn Код:
if(IsPlayerInRangeOfPoint(playerid, /*putyourradiohere*/, -2097.8840,2714.8054,163.9876))

example

if(IsPlayerInRangeOfPoint(playerid, 2.0, x, y, z))
and put return 1; before the brackets inside the Public.

Example

pawn Код:
public StreamScaryMusic(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        if(IsPlayerInRangeOfPoint(playerid,-2097.8840,2714.8054,163.9876));
        {
            PlayAudioStreamForPlayer(playerid,"http://205.196.120.224/1bdskxj5catg/ltnktunymuk/Free+Halloween+Music+mixed+by+MonsterPulse.mp3,20,1"); //Like this?
            return true;
        }
    }
    return 1;
}



Re: Help with 1ERROR! - goviscrap - 01.12.2012

Thanks for answer!..

Ill did this:
Код:
public StreamScaryMusic(playerid)
{
    if(IsPlayerConnected(playerid))
	{
		if(IsPlayerInRangeOfPoint(playerid,2.0,-2097.8840,2714.8054,163.9876))
		{
			PlayAudioStreamForPlayer(playerid,"http://205.196.120.224/1bdskxj5catg/ltnktunymuk/Free+Halloween+Music+mixed+by+MonsterPulse.mp3,20,1"); //Like this?
			return true;
		}
		return 1;
	}
}
And got this warning:
Код:
C:\Users\Nicklas\Desktop\PRP\gamemodes\PRP.pwn(13867) : warning 209: function "StreamScaryMusic" should return a value
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
And I dont understand really..
Код:
if(IsPlayerInRangeOfPoint(playerid, /*putyourradiohere*/, -2097.8840,2714.8054,163.9876))
Shall I add the AudioStream URL where the comment line is? or just what i did 2.0?


Re: Help with 1ERROR! - JaKe Elite - 01.12.2012

I meant to say "/*putyourradiushere*/" i just wake this morning so i can't post correctly right now.
And for the first warning do

this

pawn Код:
public StreamScaryMusic(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        if(IsPlayerInRangeOfPoint(playerid, /*yourradiushere*/, -2097.8840,2714.8054,163.9876));
        {
            PlayAudioStreamForPlayer(playerid,"http://205.196.120.224/1bdskxj5catg/ltnktunymuk/Free+Halloween+Music+mixed+by+MonsterPulse.mp3,20,1"); //Like this?
            return true;
        }
    }
    return 1;
}
"/*putyourrangehere*/" - The furthest distance the player can be to be in range.
Which means if the player is near in the range. The player can here the music.


Re: Help with 1ERROR! - goviscrap - 01.12.2012

Thanks! =) now it Compiled with No errors or Warnings! BUT i had to remove one thing from you wrote to me";"
Because ive got a Error: Empty state..
So now it works fine!
Код:
if(IsPlayerInRangeOfPoint(playerid, /*yourradiushere*/, -2097.8840,2714.8054,163.9876));
..


Re: Help with 1ERROR! - goviscrap - 01.12.2012

Tested the Code ingame but when i enters that Area Nothing happends?.. What can be the problem?


Re: Help with 1ERROR! - JaKe Elite - 01.12.2012

remove the ";" in the IsPlayerInRangeOfPoint..


Re: Help with 1ERROR! - NumbSkull - 01.12.2012

you took out the
pawn Код:
if(IsPlayerInRangeOfPoint(playerid, /*yourradiushere*/, -2097.8840,2714.8054,163.9876))
so it doesnt detect the area it just does it all over
try this
pawn Код:
if(IsPlayerInRangeOfPoint(playerid, 30.0, -2097.8840,2714.8054,163.9876))
and make sure you are doing what ever calls public StreamScaryMusic(playerid)


Re: Help with 1ERROR! - goviscrap - 01.12.2012

What more than forward do i have to add to make it call the Public?


Re: Help with 1ERROR! - JaKe Elite - 01.12.2012

did you call the callback by setting a timer.
Or it's just a function??