Checkpoint help
#1

This won't show up when i enter the checkpoint, mabye you guys can help me out thanks in advance!

Код:
			   GameTextForPlayer(playerid, "~b~~h~Clothing Shop~n~~w~Outfit: ~g~$200~n~~r~/clothes~n~(/items for hats, glases etc..)", 3000, 5);
Код:
#define CHECKPOINT_CLOTHES 128
PHP код:
public OnPlayerEnterCheckpoint(playerid)
{
     switch(
GetPVarInt(playerid"Checkpoint"))
        {
            case 
CHECKPOINT_NONEDisablePlayerCheckpoint(playerid);
               case 
CHECKPOINT_CLOTHES:
               {
               
GameTextForPlayer(playerid"~b~~h~Clothing Shop~n~~w~Outfit: ~g~$200~n~~r~/clothes~n~(/items for hats, glases etc..)"30005);
              }
        }
    } 
PHP код:
new Float:CheckpointAreas[6][6] = {
{
207.5909,-110.5292,1005.7423,217.4284,-99.3221,1003.7321}, // Binco
{204.5461,-167.7819,1000.7054,204.2256,-159.8634,999.5313}, // Didier Sachs
{207.1015,-139.8937,1003.5370,199.2238,-128.6456,1002.9193}, // Pro Laps
{203.9850,-50.3426,1002.0959,203.7788,-43.4468,1001.5625}, // Suburban
{226.8983,-7.9157,1002.3958,206.3996,-8.5240,1000.2086}, // Victim
{161.2953,-95.8920,1001.9630,161.2016,-83.5888,1000.8359// ZIP
};
new 
CheckpointAreaType[6][1] = {
{
CHECKPOINT_CLOTHES},
{
CHECKPOINT_CLOTHES},
{
CHECKPOINT_CLOTHES},
{
CHECKPOINT_CLOTHES},
{
CHECKPOINT_CLOTHES},
{
CHECKPOINT_CLOTHES}
}; 
PHP код:
forward LoadChecks(playerid);
public 
LoadChecks(playerid)
{
    for(new 
0sizeof(CheckpointAreas); i++)
    {
        if(
IsPlayerInRangeOfPoint(playerid,20.0,CheckpointAreas[i][0],CheckpointAreas[i][1],CheckpointAreas[i][2]))
        {
            
SetPlayerCheckpoint(playerid,CheckpointAreas[i][3],CheckpointAreas[i][4],CheckpointAreas[i][5],1.0);
            
SetPVarInt(playerid"Checkpoint"CheckpointAreaType[i][0]);
        }
    }
    return 
1;

Reply
#2

try figuring it out with some debug messages...
Код:
public LoadChecks(playerid) 
{ 
    for(new i = 0; i < sizeof(CheckpointAreas); i++) 
    { 
        if(IsPlayerInRangeOfPoint(playerid,20.0,CheckpointAreas[i][0],CheckpointAreas[i][1],CheckpointAreas[i][2])) 
        { 
            SetPlayerCheckpoint(playerid,CheckpointAreas[i][3],CheckpointAreas[i][4],CheckpointAreas[i][5],1.0); 
            SetPVarInt(playerid, "Checkpoint", CheckpointAreaType[i][0]); 
            printf("set to number %d", i);
        } 
    } 
    return 1; 
}
Код:
public OnPlayerEnterCheckpoint(playerid) 
{ 
      prinf("pvar 'Checkpoint' has value %d - Clothes should be %d", GetPVarInt(playerid, "Checkpoint"), CHECKPOINT_CLOTHES);
     switch(GetPVarInt(playerid, "Checkpoint")) 
        { 
            case CHECKPOINT_NONE: DisablePlayerCheckpoint(playerid); 
               case CHECKPOINT_CLOTHES: 
               { 
               GameTextForPlayer(playerid, "~b~~h~Clothing Shop~n~~w~Outfit: ~g~$200~n~~r~/clothes~n~(/items for hats, glases etc..)", 3000, 5); 
              } 
        } 
        retrun 1;
}
and check the results to figure out where it's failing to work/save


edit: you could btw use "default: DisablePlayerCheckpoint(playerid);" instead of defining "CHECKPOINT_NONE"
Reply
#3

You shouldn't really use pvars.
Reply
#4

Quote:
Originally Posted by Sascha
Посмотреть сообщение
try figuring it out with some debug messages...
Код:
public LoadChecks(playerid) 
{ 
    for(new i = 0; i < sizeof(CheckpointAreas); i++) 
    { 
        if(IsPlayerInRangeOfPoint(playerid,20.0,CheckpointAreas[i][0],CheckpointAreas[i][1],CheckpointAreas[i][2])) 
        { 
            SetPlayerCheckpoint(playerid,CheckpointAreas[i][3],CheckpointAreas[i][4],CheckpointAreas[i][5],1.0); 
            SetPVarInt(playerid, "Checkpoint", CheckpointAreaType[i][0]); 
            printf("set to number %d", i);
        } 
    } 
    return 1; 
}
Код:
public OnPlayerEnterCheckpoint(playerid) 
{ 
      prinf("pvar 'Checkpoint' has value %d - Clothes should be %d", GetPVarInt(playerid, "Checkpoint"), CHECKPOINT_CLOTHES);
     switch(GetPVarInt(playerid, "Checkpoint")) 
        { 
            case CHECKPOINT_NONE: DisablePlayerCheckpoint(playerid); 
               case CHECKPOINT_CLOTHES: 
               { 
               GameTextForPlayer(playerid, "~b~~h~Clothing Shop~n~~w~Outfit: ~g~$200~n~~r~/clothes~n~(/items for hats, glases etc..)", 3000, 5); 
              } 
        } 
        retrun 1;
}
and check the results to figure out where it's failing to work/save


edit: you could btw use "default: DisablePlayerCheckpoint(playerid);" instead of defining "CHECKPOINT_NONE"
Only print this one
Код:
printf("set to number %d", i);
Something is wrong here

Код:
public OnPlayerEnterCheckpoint(playerid) 
{ 
      prinf("pvar 'Checkpoint' has value %d - Clothes should be %d", GetPVarInt(playerid, "Checkpoint"), CHECKPOINT_CLOTHES);
     switch(GetPVarInt(playerid, "Checkpoint")) 
        { 
            case CHECKPOINT_NONE: DisablePlayerCheckpoint(playerid); 
               case CHECKPOINT_CLOTHES: 
               { 
               GameTextForPlayer(playerid, "~b~~h~Clothing Shop~n~~w~Outfit: ~g~$200~n~~r~/clothes~n~(/items for hats, glases etc..)", 3000, 5); 
              } 
        } 
        retrun 1;
}
Reply
#5

you did correct my typo from "prinf" to "printf" didn't you? (just to be sure)...

Then at least we know that "OnPlayerEnterCheckpoint" is not called
Are you using any streamer or so?
Reply
#6

Quote:
Originally Posted by Sascha
Посмотреть сообщение
you did correct my typo from "prinf" to "printf" didn't you? (just to be sure)...

Then at least we know that "OnPlayerEnterCheckpoint" is not called
Are you using any streamer or so?
Yes i have, cus i have another checkpoint system for my dmv.
Reply
#7

maybe that's influencing the system in a way, although I have no clue tbh...
I'd try to work with the dynamic checkpoints only...
You could also try a print("called"); message on the "OnPlayerEnterDynamicCP" to check whether that is somehow called when entering the normal CP...
Reply
#8

Quote:
Originally Posted by Sascha
Посмотреть сообщение
maybe that's influencing the system in a way, although I have no clue tbh...
I'd try to work with the dynamic checkpoints only...
You could also try a print("called"); message on the "OnPlayerEnterDynamicCP" to check whether that is somehow called when entering the normal CP...
I already sloved this problem but thanks for helping out
Reply
#9

Would you mind letting us know how?
So in case anyone else appears to have this problem knows how he could address it
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)