SA-MP Forums Archive
Help please, thanks. - 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: Help please, thanks. (/showthread.php?tid=641141)



Help please, thanks. - Puff - 11.09.2017

PHP код:
public OnPlayerEnterRaceCheckpoint(playerid)
{
    if(
IsPlayerInRangeOfPoint(playerid7.01892.8652,-1128.9633,23.8613) && GetPVarType(playerid"DeliveringNP") && IsPlayerInRaceCheckpoint(playerid))
        {
        
SetPlayerRaceCheckpoint(playerid0,1910.5698,-1127.7013,24.315300,05.0);
        }
    if(
IsPlayerInRangeOfPoint(playerid7.01910.5698,-1127.7013,24.3153) && GetPVarType(playerid"DeliveringNP") && IsPlayerInRaceCheckpoint(playerid))
        {
        
SetPlayerRaceCheckpoint(playerid01922.7101,-1127.5437,24.6200,00,05.0);
        }
    if(
IsPlayerInRangeOfPoint(playerid7.01922.7101,-1127.5437,24.6200) && GetPVarType(playerid"DeliveringNP") && IsPlayerInRaceCheckpoint(playerid))
    {
        
SetPlayerRaceCheckpoint(playerid01935.3966,-1127.6398,24.9208,00,05.0);
        }
    if(
IsPlayerInRangeOfPoint(playerid7.01935.3966,-1127.6398,24.9208) && GetPVarType(playerid"DeliveringNP") && IsPlayerInRaceCheckpoint(playerid))
        {
        
SetPlayerRaceCheckpoint(playerid01955.3051,-1127.9552,25.4240,00,05.0);
        }
    if(
IsPlayerInRangeOfPoint(playerid7.01955.3051,-1127.9552,25.4240) && GetPVarType(playerid"DeliveringNP") && IsPlayerInRaceCheckpoint(playerid))
        {
        
SetPlayerRaceCheckpoint(playerid01999.3730,-1129.3199,25.0862,00,05.0);
        }
    if(
IsPlayerInRangeOfPoint(playerid7.01999.3730,-1129.3199,25.0862) && GetPVarType(playerid"DeliveringNP") && IsPlayerInRaceCheckpoint(playerid))
        {
        
SetPlayerRaceCheckpoint(playerid02023.0809,-1128.4589,24.4188,00,05.0);
        }
    if(
IsPlayerInRangeOfPoint(playerid7.02023.0809,-1128.4589,24.4188) && GetPVarType(playerid"DeliveringNP") && IsPlayerInRaceCheckpoint(playerid))
        {
        
SetPlayerRaceCheckpoint(playerid02052.1731,-1127.4674,23.5879,00,05.0);
        }
    if(
IsPlayerInRangeOfPoint(playerid7.02052.1731,-1127.4674,23.5879) && GetPVarType(playerid"DeliveringNP") && IsPlayerInRaceCheckpoint(playerid))
        {
        
SetPlayerRaceCheckpoint(playerid02077.6431,-1122.7905,23.6244,00,05.0);
        }
    if(
IsPlayerInRangeOfPoint(playerid7.02077.6431,-1122.7905,23.6244) && GetPVarType(playerid"DeliveringNP") && IsPlayerInRaceCheckpoint(playerid))
        {
        
SetPlayerRaceCheckpoint(playerid02350.9204,-1162.5967,26.9414,00,05.0);
        }
    if(
IsPlayerInRangeOfPoint(playerid7.02350.9204,-1162.5967,26.9414) && GetPVarType(playerid"DeliveringNP") && IsPlayerInRaceCheckpoint(playerid))
        {
        
SetPlayerRaceCheckpoint(playerid02366.5081,-1197.6523,26.9864,00,05.0);
        }
    if(
IsPlayerInRangeOfPoint(playerid7.02366.5081,-1197.6523,26.9864) && GetPVarType(playerid"DeliveringNP") && IsPlayerInRaceCheckpoint(playerid))
        {
        
SetPlayerRaceCheckpoint(playerid02376.5500,-1275.7950,23.5722,00,05.0);
        }
    if(
IsPlayerInRangeOfPoint(playerid7.02376.5500,-1275.7950,23.5722) && GetPVarType(playerid"DeliveringNP") && IsPlayerInRaceCheckpoint(playerid))
        {
        
SetPlayerRaceCheckpoint(playerid02378.4927,-1325.7792,23.5584,00,05.0);
        }
    if(
IsPlayerInRangeOfPoint(playerid7.02378.4927,-1325.7792,23.5584) && GetPVarType(playerid"DeliveringNP") && IsPlayerInRaceCheckpoint(playerid))
        {
        
SetPlayerRaceCheckpoint(playerid02378.3125,-1345.9044,23.5611,00,05.0);
        }
    if(
IsPlayerInRangeOfPoint(playerid7.02378.3125,-1345.9044,23.5611) && GetPVarType(playerid"DeliveringNP") && IsPlayerInRaceCheckpoint(playerid))
        {
        
SetPlayerRaceCheckpoint(playerid02378.0193,-1364.6858,23.5561,00,05.0);
        }
    if(
IsPlayerInRangeOfPoint(playerid7.02378.0193,-1364.6858,23.5561) && GetPVarType(playerid"DeliveringNP") && IsPlayerInRaceCheckpoint(playerid))
        {
        
SetPlayerRaceCheckpoint(playerid02402.4192,-1724.3811,13.1474,00,05.0);
        }
    if(
IsPlayerInRangeOfPoint(playerid7.02402.4192,-1724.3811,13.1474) && GetPVarType(playerid"DeliveringNP") && IsPlayerInRaceCheckpoint(playerid))
        {
        
SetPlayerRaceCheckpoint(playerid02390.3557,-1724.2540,13.1269,00,05.0);
        }
    if(
IsPlayerInRangeOfPoint(playerid7.02390.3557,-1724.2540,13.1269) && GetPVarType(playerid"DeliveringNP") && IsPlayerInRaceCheckpoint(playerid))
        {
        
SetPlayerRaceCheckpoint(playerid02319.1663,-1723.6019,13.0823,00,05.0);
        }
    if(
IsPlayerInRangeOfPoint(playerid7.02319.1663,-1723.6019,13.0823) && GetPVarType(playerid"DeliveringNP") && IsPlayerInRaceCheckpoint(playerid))
        {
        
SetPlayerRaceCheckpoint(playerid02310.2207,-1723.5612,13.1159,00,05.0);
        }
    if(
IsPlayerInRangeOfPoint(playerid7.02310.2207,-1723.5612,13.1159) && GetPVarType(playerid"DeliveringNP") && IsPlayerInRaceCheckpoint(playerid))
        {
        
SetPlayerRaceCheckpoint(playerid02262.8872,-1752.5686,12.9525,00,05.0);
        }
    if(
IsPlayerInRangeOfPoint(playerid7.02262.8872,-1752.5686,12.9525) && GetPVarType(playerid"DeliveringNP") && IsPlayerInRaceCheckpoint(playerid))
        {
        
SetPlayerRaceCheckpoint(playerid02297.9568,-1752.8525,12.9478,00,05.0);
        }
    if(
IsPlayerInRangeOfPoint(playerid7.02297.9568,-1752.8525,12.9478) && GetPVarType(playerid"DeliveringNP") && IsPlayerInRaceCheckpoint(playerid))
        {
        
SetPlayerRaceCheckpoint(playerid02336.1619,-1752.9246,12.9580,00,05.0);
        }
    if(
IsPlayerInRangeOfPoint(playerid7.02336.1619,-1752.9246,12.9580) && GetPVarType(playerid"DeliveringNP") && IsPlayerInRaceCheckpoint(playerid))
        {
        
SetPlayerRaceCheckpoint(playerid02371.1050,-1752.9904,12.9387,00,05.0);
        }
    if(
IsPlayerInRangeOfPoint(playerid7.02371.1050,-1752.9904,12.9387) && GetPVarType(playerid"DeliveringNP") && IsPlayerInRaceCheckpoint(playerid))
    {
        
SetPlayerRaceCheckpoint(playerid02306.8257,-1665.4425,14.1134,00,05.0);
        }
    if(
IsPlayerInRangeOfPoint(playerid7.02306.8257,-1665.4425,14.1134) && GetPVarType(playerid"DeliveringNP") && IsPlayerInRaceCheckpoint(playerid))
        {
        
SetPlayerRaceCheckpoint(playerid02366.1140,-1665.8473,13.1034,00,05.0);
        }
    if(
IsPlayerInRangeOfPoint(playerid7.02366.1140,-1665.8473,13.1034) && GetPVarType(playerid"DeliveringNP") && IsPlayerInRaceCheckpoint(playerid))
        {
        
SetPlayerRaceCheckpoint(playerid02385.2559,-1666.3292,13.1172,00,05.0);
        }
    if(
IsPlayerInRangeOfPoint(playerid7.02385.2559,-1666.3292,13.1172) && GetPVarType(playerid"DeliveringNP") && IsPlayerInRaceCheckpoint(playerid))
        {
        
SetPlayerRaceCheckpoint(playerid02408.2407,-1666.9655,13.1017,00,05.0);
        }
    if(
IsPlayerInRangeOfPoint(playerid7.02408.2407,-1666.9655,13.1017) && GetPVarType(playerid"DeliveringNP") && IsPlayerInRaceCheckpoint(playerid))
        {
        
SetPlayerRaceCheckpoint(playerid02494.3252,-1682.3666,12.8981,00,05.0);
        }
    if(
IsPlayerInRangeOfPoint(playerid7.02494.3252,-1682.3666,12.8981) && GetPVarType(playerid"DeliveringNP") && IsPlayerInRaceCheckpoint(playerid))
        {
        
SetPlayerRaceCheckpoint(playerid02505.3652,-1681.6534,13.1084,00,05.0);
        }
    if(
IsPlayerInRangeOfPoint(playerid7.02505.3652,-1681.6534,13.1084) && GetPVarType(playerid"DeliveringNP") && IsPlayerInRaceCheckpoint(playerid))
        {
        
SetPlayerRaceCheckpoint(playerid02511.4209,-1672.6965,13.0089,00,05.0);
        }
    if(
IsPlayerInRangeOfPoint(playerid7.02511.4209,-1672.6965,13.0089) && GetPVarType(playerid"DeliveringNP") && IsPlayerInRaceCheckpoint(playerid))
        {
        
SetPlayerRaceCheckpoint(playerid02511.2000,-1663.6833,13.1542,00,05.0);
        }
    if(
IsPlayerInRangeOfPoint(playerid7.02511.2000,-1663.6833,13.1542) && GetPVarType(playerid"DeliveringNP") && IsPlayerInRaceCheckpoint(playerid))
        {
        
SetPlayerRaceCheckpoint(playerid02506.1387,-1657.3492,13.1540,00,05.0);
        }
    if(
IsPlayerInRangeOfPoint(playerid7.02506.1387,-1657.3492,13.1540) && GetPVarType(playerid"DeliveringNP") && IsPlayerInRaceCheckpoint(playerid))
        {
        
SetPlayerRaceCheckpoint(playerid02497.4653,-1652.5718,13.0224,00,05.0);
        }
    if(
IsPlayerInRangeOfPoint(playerid7.02497.4653,-1652.5718,13.0224) && GetPVarType(playerid"DeliveringNP") && IsPlayerInRaceCheckpoint(playerid))
        {
        
SetPlayerRaceCheckpoint(playerid02487.1057,-1652.0659,13.0493,00,05.0);
        }
    if(
IsPlayerInRangeOfPoint(playerid7.02487.1057,-1652.0659,13.0493) && GetPVarType(playerid"DeliveringNP") && IsPlayerInRaceCheckpoint(playerid))
        {
        
SetPlayerRaceCheckpoint(playerid02469.5320,-1652.3706,13.0266,00,05.0);
        }
    if(
IsPlayerInRangeOfPoint(playerid7.02469.5320,-1652.3706,13.0266) && GetPVarType(playerid"DeliveringNP") && IsPlayerInRaceCheckpoint(playerid))
        {
        
SetPlayerRaceCheckpoint(playerid02452.8955,-1652.2856,12.9471,00,05.0);
        }
    if(
IsPlayerInRangeOfPoint(playerid7.02452.8955,-1652.2856,12.9471) && GetPVarType(playerid"DeliveringNP") && IsPlayerInRaceCheckpoint(playerid))
        {
        
SetPlayerRaceCheckpoint(playerid02415.3684,-1651.3464,13.0835,00,05.0);
        }
    if(
IsPlayerInRangeOfPoint(playerid7.02415.3684,-1651.3464,13.0835) && GetPVarType(playerid"DeliveringNP") && IsPlayerInRaceCheckpoint(playerid))
        {
        
SetPlayerRaceCheckpoint(playerid02393.8899,-1651.1527,13.1168,00,05.0);
        }
    if(
IsPlayerInRangeOfPoint(playerid7.02393.8899,-1651.1527,13.1168) && GetPVarType(playerid"DeliveringNP") && IsPlayerInRaceCheckpoint(playerid))
        {
        
SetPlayerRaceCheckpoint(playerid02363.1104,-1651.2174,13.1096,00,05.0);
        }
    if(
IsPlayerInRangeOfPoint(playerid7.02363.1104,-1651.2174,13.1096) && GetPVarType(playerid"DeliveringNP") && IsPlayerInRaceCheckpoint(playerid))
        {
        
SetPlayerRaceCheckpoint(playerid02281.0745,-1651.6519,14.7354,00,05.0);
        }
    if(
IsPlayerInRangeOfPoint(playerid7.02281.0745,-1651.6519,14.7354) && GetPVarType(playerid"DeliveringNP") && IsPlayerInRaceCheckpoint(playerid))
        {
        
SetPlayerRaceCheckpoint(playerid02257.1074,-1649.6342,15.0343,00,05.0);
        }
    if(
IsPlayerInRangeOfPoint(playerid7.02257.1074,-1649.6342,15.0343) && GetPVarType(playerid"DeliveringNP") && IsPlayerInRaceCheckpoint(playerid))
        {
        
SetPlayerRaceCheckpoint(playerid02237.9353,-1645.2035,15.0412,00,05.0);
        }
    if(
IsPlayerInRangeOfPoint(playerid7.02237.9353,-1645.2035,15.0412) && GetPVarType(playerid"DeliveringNP") && IsPlayerInRaceCheckpoint(playerid))
        {
        
SetPlayerRaceCheckpoint(playerid01787.4531,-1294.2441,13.0736,00,05.0);
        }
    if(
IsPlayerInRangeOfPoint(playerid7.01787.4531,-1294.2441,13.0736) && GetPVarType(playerid"DeliveringNP") && IsPlayerInRaceCheckpoint(playerid))
        {
        
GivePlayerMoney(playerid90);
        
SetPlayerRaceCheckpoint(playerid01892.8652,-1128.9633,23.8613,00,05.0);
        
GameTextForPlayer(playerid"~p~ You delivered all papers, you got ~r~90$ ~p~for that"30004);
        
DisablePlayerRaceCheckpoint(playerid);
        }
    return 
1;

This isn't working correctly.. when I enter the first checkpoint.. nothing happens it doesn't send me another checkpoint.. help.


Re: Help please, thanks. - Kane - 11.09.2017

You should really read your old thread and not make a new thread for absolutely no reason.

http://forum.sa-mp.com/showthread.ph...07#post3925707
Quote:
Originally Posted by Arthur Kane
Посмотреть сообщение
Why're you using SetPlayerRaceCheckpoint if you aren't gonna make use of nextx, nexty, and nextz parameters?

Just use SetPlayerCheckpoint. And the problem most likely is GetPVarType.

GetPVarType returns the type of the PVar. What you're looking for is GetPVarInt.

https://sampwiki.blast.hk/wiki/GetPVarType
https://sampwiki.blast.hk/wiki/GetPVarInt

Also a suggestion, your code is very messy and could be simpler. I recommend making an array, for example:

PHP код:
enum E_CHECKPOINT_DATA
{
    
Float:P_CHECKPOINT_X,
    
Float:P_CHECKPOINT_Y,
    
Float:P_CHECKPOINT_Z,
    
Float:P_CHECKPOINT_NEW_X,
    
Float:P_CHECKPOINT_NEW_Y,
    
Float:P_CHECKPOINT_NEW_Z
}
new 
g_aCheckpointData[][E_CHECKPOINT_DATA] = 
{
    {
1701.7723, -1505.400313.38281699.6165, -1538.992213.3828}
};
CMD:deliver(playeridparams[])
{
    new
        
str[128],
        
index = -1
    
;
    for(new 
0sizeof g_aCheckpointDatai++)
    {
        if(
IsPlayerInRangeOfPoint(playerid3.0g_aCheckpointData[i][P_CHECKPOINT_X], g_aCheckpointData[i][P_CHECKPOINT_Y], g_aCheckpointData[i][P_CHECKPOINT_Z]))
        {
            
index i;
            break;
        }
    }
    
    if(
index != -1)
    {
        
format(strsizeof(str), "You're near coordinates %f, %f, %f in checkpoint data %i."g_aCheckpointData[index][P_CHECKPOINT_X], g_aCheckpointData[index][P_CHECKPOINT_Y], g_aCheckpointData[index][P_CHECKPOINT_Z], index);
        
SendClientMessage(playerid, -1str); 
        
        
SetPlayerCheckpoint(playeridg_aCheckpointData[index][P_CHECKPOINT_NEW_X], g_aCheckpointData[index][P_CHECKPOINT_NEW_Y], g_aCheckpointData[index][P_CHECKPOINT_NEW_Z], 5.0);
    }
    return 
1

Results.



Re: Help please, thanks. - Puff - 11.09.2017

Quote:
Originally Posted by Arthur Kane
Посмотреть сообщение
You should really read your old thread and not make a new thread for absolutely no reason.

http://forum.sa-mp.com/showthread.ph...07#post3925707
Oh right, my bad didn't see your reply. haha thanks,


Re: Help please, thanks. - Puff - 11.09.2017

Quote:
Originally Posted by Arthur Kane
Посмотреть сообщение
You should really read your old thread and not make a new thread for absolutely no reason.

http://forum.sa-mp.com/showthread.ph...07#post3925707
this didn't solve the problem, did everything you said.. it gives me wrong checkpoint @ random pos..


Re: Help please, thanks. - Kane - 11.09.2017

Show your change of code.