SA-MP Forums Archive
a little help. - 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: a little help. (/showthread.php?tid=455020)



a little help. - Yves - 31.07.2013

I am trying to add a new IsPlayerInRageOfPoint in one line when i did that i get 2 or 3 errors.

Код:
											// LSPD                                                     	// SASD
	if(!IsPlayerInRangeOfPoint(playerid, 10, 1526, -1676, 5.89) || if(IsPlayerInRangeOfPoint(playerid, 283, 613.8015, -589.0556,17.2330,268.7866 || return SendClientMessage(playerid, -1, "You are not at the arrest point.");
Код:
C:\Users\Brandon\Desktop\Generation X Gaming\gamemodes\GXGNEW.pwn(1942) : warning 202: number of arguments does not match definition
C:\Users\Brandon\Desktop\Generation X Gaming\gamemodes\GXGNEW.pwn(5439) : error 029: invalid expression, assumed zero
C:\Users\Brandon\Desktop\Generation X Gaming\gamemodes\GXGNEW.pwn(5439) : error 029: invalid expression, assumed zero
C:\Users\Brandon\Desktop\Generation X Gaming\gamemodes\GXGNEW.pwn(7803) : warning 213: tag mismatch
C:\Users\Brandon\Desktop\Generation X Gaming\gamemodes\GXGNEW.pwn(7803) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664



Re: a little help. - JimmyCh - 31.07.2013

Try the following:
pawn Код:
if(!IsPlayerInRangeOfPoint(playerid, 10, 1526, -1676, 5.89) || !IsPlayerInRangeOfPoint(playerid, 10, 613.8015, -589.0556,17.2330,268.7866))
    return SendClientMessage(playerid, -1, "You are not at the arrest point.");
Edited because I had not noticed I had forgot one ")"


Re: a little help. - Konstantinos - 31.07.2013

pawn Код:
if(!IsPlayerInRangeOfPoint(playerid, 10, 1526, -1676, 5.89) || !IsPlayerInRangeOfPoint(playerid, 10, 613.8015, -589.0556,17.2330)) return SendClientMessage(playerid, -1, "You are not at the arrest point.");
You cannot have an if inside if like that:
pawn Код:
if( something || if( something2 ) )
// Not correct
And instead of closing the parentheses and return an error message, you use "||".

Anyways, the last IsPlayerInRangeOfPoint was a bit.. 4 parameters (x, y, z, angle) and I think the previous parameter was skin instead of the range. I suppose it's if he's not in that range the second as well.


Re: a little help. - arjanforgames - 31.07.2013

The line should be:

pawn Код:
if(!IsPlayerInRangeOfPoint(playerid, 10, 1526, -1676, 5.89) || !IsPlayerInRangeOfPoint(playerid, 283, 613.8015, -589.0556,17.2330,268.7866 return SendClientMessage(playerid, -1, "You are not at the arrest point.");



Re: a little help. - Konstantinos - 31.07.2013

Quote:
Originally Posted by arjanforgames
Посмотреть сообщение
The line should be:

pawn Код:
if(!IsPlayerInRangeOfPoint(playerid, 10, 1526, -1676, 5.89) || !IsPlayerInRangeOfPoint(playerid, 283, 613.8015, -589.0556,17.2330,268.7866 return SendClientMessage(playerid, -1, "You are not at the arrest point.");
Still incorrect. You do not close the parentheses for the if statement and it finds "return" instead of ")".


Re: a little help. - Yves - 31.07.2013

am sure you can have it on one line with ||

Anyways thanks for the help guys much helpful.


Re: a little help. - Konstantinos - 31.07.2013

Quote:
Originally Posted by Yves
Посмотреть сообщение
am sure you can have it on one line with ||
Yes you can have in one line with || Inside a statement. Not outside and return a value after that.

This is what you did.
pawn Код:
if( something || something2 || return Error();
// ERRORS



Re: a little help. - Yves - 31.07.2013

Quote:
Originally Posted by _Zeus
Посмотреть сообщение
Yes you can have in one line with || Inside a statement. Not outside and return a value after that.

This is what you did.
pawn Код:
if( something || something2 || return Error();
// ERRORS
i see thanks alot tho mate. at least i know now just learning something everyday


Re: a little help. - JimmyCh - 31.07.2013

You cannot put || then return a client message.
You must close the if( ..code..) then return a message.
Hope you see the idea of this


Re: a little help. - Yves - 31.07.2013

Quote:
Originally Posted by JimmyCh
Посмотреть сообщение
You cannot put || then return a client message.
You must close the if( ..code..) then return a message.
Hope you see the idea of this
yeah i know that thanks tho