Argument!
#1

PHP код:
stock IsPlayerInRobberyCheckpoint(playerid)
{
    for(new 
i=0sizeof(RobberyCPS); i++)
    {
        if(
IsPlayerInDynamicCP(playeridRobberyCPS[i]))
        {
            return 
1;
        }
    }
    return 
0;

Error:[code]
mysql.pwn(1434) : error 035: argument type mismatch (argument 2)[code]

PHP код:
new Float:RobberyCPS[14][3] = //ROBBERY LEVEL 1
    
{
        {
312.1780,-165.7560,999.6010}, 
        {
162.6582,-83.7168,1001.8047}, 
        {-
22.0830,-55.0324,1003.5469}, 
        {
206.1702,-100.3265,1005.2578},
        {
374.6855,-119.1805,1001.4995},
        {
412.1748,-17.7801,1001.8047}, 
        {-
202.8483,-40.6346,1002.2734}, 
        {
202.9123,-43.7781,1001.8047}, 
        {
369.3495,-6.0167,1001.8516}, 
        {
376.3930,-67.6462,1001.5151}, 
        {
410.8336,-52.6126,1001.8984}, 
        {
206.3587,-129.1778,1003.5078}, 
        {
204.1029,-159.6707,1000.5234}, 
        {
206.6491,-8.2347,1001.2109
    }; 
Reply
#2

The IsPlayerInDynamicCP function is looking for a checkpointid value, not the location of the checkpoint.

pawn Код:
IsPlayerInDynamicCP(playerid, checkpointid)  { /* code */ }
Somewhere within your script, you must have created dynamic checkpoints using something like:



pawn Код:
new RobberyCheckpoints[14];

for(...) // for loop
{
   RobberyCheckpoints[i] = CreateDynamicCheckpoint(RobberyCPs[i][0], RobberyCPs[i][1], RobberyCPs[i][2]...);
}
You need to use this variable:
pawn Код:
RobberyCheckpoints[...]
So your code should look like this:
pawn Код:
stock IsPlayerInRobberyCheckpoint(playerid)
{
    for(new i=0; i < sizeof(RobberyCPS); i++)
    {
        if(IsPlayerInDynamicCP(playerid, RobberyCheckpoints[i]))
        {
            return 1;
        }
    }
    return 0;
}
Reply
#3

Quote:
Originally Posted by EiresJason
Посмотреть сообщение
The IsPlayerInDynamicCP function is looking for a checkpointid value, not the location of the checkpoint.

pawn Код:
IsPlayerInDynamicCP(playerid, checkpointid)  { /* code */ }
Somewhere within your script, you must have created dynamic checkpoints using something like:



pawn Код:
new RobberyCheckpoints[14];

for(...) // for loop
{
   RobberyCheckpoints[i] = CreateDynamicCheckpoint(RobberyCPs[i][0], RobberyCPs[i][1], RobberyCPs[i][2]...);
}
You need to use this variable:
pawn Код:
RobberyCheckpoints[...]
So your code should look like this:
pawn Код:
stock IsPlayerInRobberyCheckpoint(playerid)
{
    for(new i=0; i < sizeof(RobberyCPS); i++)
    {
        if(IsPlayerInDynamicCP(playerid, RobberyCheckpoints[i]))
        {
            return 1;
        }
    }
    return 0;
}
Ι changed it and did this
PHP код:
stock IsPlayerInRobberyCheckpoint(playerid)
{
    
        if(
IsPlayerInDynamicCP(playeridsizeof(RobberyCPS)))
        {
            return 
1;
        }
    return 
0;

Is it wrong though ?
Reply
#4

Yeah that's not correct.

Where do you actually create the dynamic checkpoints?

You must have code similar to this:
pawn Код:
RobberyCheckpoints[i] = CreateDynamicCheckpoint(RobberyCPs[i][0], RobberyCPs[i][1], RobberyCPs[i][2]...);
Unless you haven't created the dynamic checkpoints at all?

Just in case it looks confusing, RobberyCheckpoints does not refer to the array of floats you have (RobberyCPs).
Reply
#5

Quote:
Originally Posted by EiresJason
Посмотреть сообщение
Yeah that's not correct.

Where do you actually create the dynamic checkpoints?

You must have code similar to this:
pawn Код:
RobberyCheckpoints[i] = CreateDynamicCheckpoint(RobberyCPs[i][0], RobberyCPs[i][1], RobberyCPs[i][2]...);
Unless you haven't created the dynamic checkpoints at all?

Just in case it looks confusing, RobberyCheckpoints does not refer to the array of floats you have (RobberyCPs).
Ok i understood now how it works thank you EiresJason !
Reply
#6

That's not an efficient way of doing this.

What you can do is set a variable to hold the id of the robbery checkpoint a player has entered. And when they leave the checkpoint, set the variable to -1.

And use the variable for reference. There's no need for a loop and it avoids using extra conditions. It's optimal for a hotkey such as LEFT ALT as well.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)