A few Errors on my Server, (To Do with PlayertoPoint)
#1

Now I Have this as my /enter and /exit Script.
}
if(!strcmp("/Enter", cmdtext, true))
{
if PlayerToPoint(2116.6833,2416.7131,49.5234);
SetPlayerPos(playerid, 354.9854,150.2702,1025.7964,359.891;
SetPlayerInterior(playerid, 3);
SetPlayerVirtualWorld(playerid, 1);
return 1;
}
if(!strcmp("/Exit", cmdtext, true))
{
if PlayerToPoint(354.9854,150.2702,1025.7964,359.8918 );
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid, 2116.6833,2416.7131,49.5234);
return 1;
}
return 0;
}

And I Have Copyed a playertopoint off a Tutorial on the forums

( PLAYER TO POINT )

public PlayerToPoint(Float:radi, playerid, Float, Float:y, Float:z)
{
if(IsPlayerConnected(playerid))
{
new Floatldposx, Floatldposy, Floatldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
tempposx = (oldposx -x);
tempposy = (oldposy -y);
tempposz = (oldposz -z);
//printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
return 1;
}
}
return 0;
}


Now When I Compile I Get an Error Saying that :
C:\Program Files\SAMP\SAMP\SAMP\gamemodes\RP2.pwn(472) : error 001: expected token: "*then", but found ";"
C:\Program Files\SAMP\SAMP\SAMP\gamemodes\RP2.pwn(472) : error 036: empty statement


Now Thats my Problem, I Cant seem to get the pattern of Playertopoint to work for me :P Help nao?
Reply
#2

Which line is 472?
I believe that PlayerToPoint has more than just the coords.
It's suppose to be PlayerToPoint(25.0,playerid,354.9854,150.2702,1025 .7964,359.891
Representing the radius/distance
Код:
25.0
Reply
#3

MMkay. Oh and Line 472 is..

if PlayerToPoint(354.9854,150.2702,1025.7964,359.8918 );
Reply
#4

Damnit Now it says 464) : error 029: invalid expression, assumed zero
Line 464 is:
if PlayerToPoint(25.0,playerid,354.9854,150.2702,1025 .7964,359.891);

Shitballs, Im Feeling the Pain :P
Reply
#5

pawn Код:
if(IsPlayerInRangeOfPoint(playerid, 25.0, 354.9854,150.2702,1025.7964))
Next time, use [code] if you want to put a script over here.
Reply
#6

You're doing it wrong.

You're having:

pawn Код:
if PlayerToPoint(2116.6833,2416.7131,49.5234);
The symbol ';' is used for functions like SendClientMessage, not for checking things like 'if(IsPlayerAdmin(playerid))'

The function PlayerToPoint is:

pawn Код:
PlayerToPoint(Float:radi,playerid,Float:x,Float:y,Float:z;)
You're only filling in the 'X', the 'Y' and the 'Z', not the radius and the playerid.

Try this for example:
pawn Код:
if(PlayerToPoint(10,playerid2116.6833,2416.7131,49.5234))
Reply
#7

Quote:
Originally Posted by Hiddos
Посмотреть сообщение
You're doing it wrong.

You're having:

pawn Код:
if PlayerToPoint(2116.6833,2416.7131,49.5234);
The symbol ';' is used for functions like SendClientMessage, not for checking things like 'if(IsPlayerAdmin(playerid))'

The function PlayerToPoint is:

pawn Код:
PlayerToPoint(Float:radi,playerid,Float:x,Float:y,Float:z;)
You're only filling in the 'X', the 'Y' and the 'Z', not the radius and the playerid.

Try this for example:
pawn Код:
if(PlayerToPoint(10,playerid2116.6833,2416.7131,49.5234))
Basically he means to not to use ';' in conditions. And you also don't need to use PlayerToPoint, we have a better one now, it's IsPlayerInRangeOfPoint.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)