Help with a ("if") line of script -
Robby5572 - 29.12.2011
Well, I'm not a great scripter but I've been trying to learn and while I'm doing this part I'm having trouble.
Basically what I am trying to is, if a player types /enter on a pickup I've put down, it will set their interior id and position through SetPlayerInterior and SetPlayerPos, and if they are not near that pickup, it will send them a message through SendClientMessage saying they are not near it.
Here is the code I tried.
Код:
if (strcmp("/enter", cmdtext, true, 10) == 0)
{
if (IsPlayerInRangeOfPoint(playerid, 846.1998, -1292.7142, 13.6526)) SetPlayerInterior(playerid, 18); SetPlayerPos(playerid, 1302.519897, -1.787510, 1001.028259);
else SendClientMessage(playerid, COLOR_YELLOW, "You are not near the car garage!");
return 1;
}
And here is the error I am getting
Код:
C:\Documents and Settings\HP_Owner\My Documents\SA-MP Scripting Files\pawno\vinewoodwarehouse.pwn(170) : warning 202: number of arguments does not match definition
C:\Documents and Settings\HP_Owner\My Documents\SA-MP Scripting Files\pawno\vinewoodwarehouse.pwn(171) : error 029: invalid expression, assumed zero
I searched on it but couldn't find anything to help me. So any help would be appreciated and I'm sure it is something so simple, so I'm pretty sure I will get a simple answer.
AW: Help with a ("if") line of script -
BigETI - 29.12.2011
Use brackets next time and IsPlayerInRangeOfPoint has not the required amount of values.
pawn Код:
IsPlayerInRangeOfPoint(playerid, Float:range, Float:X, Float:Y, Float:Z)
How it could solve the problem:
pawn Код:
if(!strcmp("/enter", cmdtext, true))
{
if(IsPlayerInRangeOfPoint(playerid, 2.0, 846.1998, -1292.7142, 13.6526))
{
SetPlayerInterior(playerid, 18);
SetPlayerPos(playerid, 1302.519897, -1.787510, 1001.028259);
}
else SendClientMessage(playerid, COLOR_YELLOW, "You are not near the car garage!");
return 1;
}
Re: Help with a ("if") line of script -
Robby5572 - 29.12.2011
Thanks, I played around with it myself and think I figured it out as well. But in case it doesn't work, this will be my solution.