SA-MP Forums Archive
Loop bug (Pickups/Checkpoints) - 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: Loop bug (Pickups/Checkpoints) (/showthread.php?tid=527164)



Loop bug (Pickups/Checkpoints) - RedSnow - 21.07.2014

I tried to make a loop on pickups, before few days it works currently and now it doesn't works, I change it to dynamic checkpoints and still nothing.
PHP код:
// Top of mode
new Pu[sizeof(InteriorInfo)+1];
// OnGameModeInit
for(new isizeof(InteriorInfo); i++)
    {
        
Pu[i] = CreatePickup(InteriorInfo[i][PickupID], 1InteriorInfo[i][OutsideX], InteriorInfo[i][OutsideY], InteriorInfo[i][OutsideZ], -1);
        
Pu2[i] = CPS_AddCheckpoint(InteriorInfo[i][InsideX], InteriorInfo[i][InsideY], InteriorInfo[i][InsideZ],1,5);
        
format(Info[Str],100,"%s\nID: %d",InteriorInfo[i][Name],i);
        
Create3DTextLabel(Info[Str], 0xB5B205FFInteriorInfo[i][OutsideX], InteriorInfo[i][OutsideY], InteriorInfo[i][OutsideZ]+0.55.000);
    }
//OnPlayerPickupPickup
public OnPlayerPickUpPickup(playeridpickupid)
{
    for(new 
isizeof(InteriorInfo); i++)
    {
        if(
pickupid == Pu[i])
        {
            
CurrentPu[playerid] = i;
            
SetPlayerVirtualWorldEx(playerid,i);
            
SetPlayerInterior(playerid,InteriorInfo[i][Interior]);
            
SetPlayerPos(playerid,InteriorInfo[i][InsideX],InteriorInfo[i][InsideY]+2.5,InteriorInfo[i][InsideZ]);
        }
    }
    if(
pickupid == PoliceRoofEnter)
    {
        
SetPlayerPos(playerid,1576.6730,-1640.7507,28.4021);
    }
    else if(
pickupid == PoliceRoofExit)
    {
        
SetPlayerPos(playerid,1601.4784,-1633.4667,13.7188);
    }
    return 
1;




Re: Loop bug (Pickups/Checkpoints) - osman2571 - 21.07.2014

You may be use createcheckpoint


Re: Loop bug (Pickups/Checkpoints) - RedSnow - 21.07.2014

Quote:
Originally Posted by osman2571
Посмотреть сообщение
You may be use createcheckpoint
why?
and I used CPS_CreateCheckpoint and still nothing.


Re: Loop bug (Pickups/Checkpoints) - osman2571 - 21.07.2014

delete CPS_
you need make custom function SetPlayerCheckpoint(playerid, -161.1902,-284.2456,4.4446, 10.0); // seample


Re: Loop bug (Pickups/Checkpoints) - RedSnow - 21.07.2014

Quote:
Originally Posted by osman2571
Посмотреть сообщение
delete CPS_
you need make custom function SetPlayerCheckpoint(playerid, -161.1902,-284.2456,4.4446, 10.0); // seample
To Buggy.


Re: Loop bug (Pickups/Checkpoints) - RedSnow - 22.07.2014

Quote:
Originally Posted by ******
Посмотреть сообщение
If it used to work and now doesn't then something must have changed. What did you change between those two times?
Nice question but I don't know.
P.S I tried to do that: https://sampforum.blast.hk/showthread.php?tid=301933
PHP код:
//Top of the mode
enum Interior_I
{
    
Name[30],
    
PickupID,
    
Float:OutsideX,
    
Float:OutsideY,
    
Float:OutsideZ,
    
Interior,
    
Float:InsideX,
    
Float:InsideY,
    
Float:InsideZ,
    
Float:BotX,
    
Float:BotY,
    
Float:BotZ,
    
BotSkin
}
static const 
InteriorInfo[][Interior_I] =
{
    
//{"Name",PickupID,OutsideX,OutsideY,OutsideZ,Interior,InsideX,InsideY,InsideZ,BotX,BotY,BotZ,Bot Skin},
    
{"MyPizza2",1582,2522.8096,-1679.2502,15.4970,5,372.3917,-133.4900,1001.4922,375.9249,-116.8117,1001.4922,155},
    {
"My pizza",1582,2422.7495,-1741.1678,13.5469,5,372.3917,-133.4900,1001.4922,375.9249,-116.8117,1001.4922,155}
};
// OnGameModeInit
for(new isizeof(InteriorInfo); i++)
    {
        
CreatePickup(InteriorInfo[i][PickupID],1,InteriorInfo[i][OutsideX], InteriorInfo[i][OutsideY], InteriorInfo[i][OutsideZ],-1);
        
format(Info[Str],100,"[%s]",InteriorInfo[i][Name]);
        
Create3DTextLabel(Info[Str], 0xB5B205FFInteriorInfo[i][OutsideX], InteriorInfo[i][OutsideY], InteriorInfo[i][OutsideZ]+0.55.000);
    }
//OnPlayerPickupPickup
for(new isizeof(InteriorInfo); i++)
    {
        if(
IsPlayerInRangeOfPoint(playerid,3.0,InteriorInfo[i][OutsideX], InteriorInfo[i][OutsideY], InteriorInfo[i][OutsideZ]))
        {
            
CurrentPu[playerid] = i;
            
SetPlayerVirtualWorldEx(playerid,i);
            
SetPlayerInterior(playerid,InteriorInfo[i][Interior]);
            
SetPlayerPos(playerid,InteriorInfo[i][InsideX],InteriorInfo[i][InsideY]+3.5,InteriorInfo[i][InsideZ]);
            break;
        }
    } 
And still nothing.


Re: Loop bug (Pickups/Checkpoints) - RedSnow - 22.07.2014

Quote:
Originally Posted by ******
Посмотреть сообщение
Can you revert to an earlier version (and if not, why not)?
samp 0.3x? or older 0.3z?


Re: Loop bug (Pickups/Checkpoints) - RedSnow - 22.07.2014

Quote:
Originally Posted by ******
Посмотреть сообщение
No, an older version of your mode.
Never mind, I fixed it, I'm so idiot.
I used "return" in SetPlayerVirtualWorldEx.