so ich mal wieder
// anfang des scripts
forward StreamCheckpoints();
forward EnableCheckpointingAgain(playerid);
forward Float:GetDistanceToInsideCheckpoint(playerid,checkpointid);
forward Float:GetDistanceToOutsideCheckpoint(playerid,checkpointid);
forward Float:GetDistanceToClosestInside(playerid);
forward Float:GetDistanceToClosestOutside(playerid);
enum CPInfo
{
Float:EnterX,
Float:EnterY,
Float:EnterZ,
Float:EnterA,
EnterInt,
ExitingText[32],
Float:ExitX,
Float:ExitY,
Float:ExitZ,
Float:ExitA,
ExitInt,
EnteringText[100],
EnteringPrice,
}
new MultipleEnter[MAX_PLAYERS];
new CheckPointing[MAX_PLAYERS];
new CheckPointShown[MAX_PLAYERS];
new Float:CPs[][CPInfo] = {
{2397.8496,-1898.0288,13.5469,0.0,0,"Los Santos",365.3238,-11.3925,1001.8516,350.3676,9,CLUCKIN_BELL_TEXT,5},// eins von denen als beispiel
};
forward StreamCheckpoints();
forward EnableCheckpointingAgain(playerid);
forward Float:GetDistanceToInsideCheckpoint(playerid,checkpointid);
forward Float:GetDistanceToOutsideCheckpoint(playerid,checkpointid);
forward Float:GetDistanceToClosestInside(playerid);
forward Float:GetDistanceToClosestOutside(playerid);
//inner mitte
public OnPlayerConnect(playerid)
{
MultipleEnter[playerid] = -1;
CheckPointing[playerid] = 1;
CheckPointShown[playerid] = 0;
]
//interior enter
if(CheckPointing[playerid] == 0)
{
return 1;
}
new cpid;
if(GetDistanceToClosestInside(playerid) < 1.0) // Man geht wo raus
{
if(MultipleEnter[playerid] != -1)
{
cpid = MultipleEnter[playerid];
}
else
{
cpid = GetClosestInsideID(playerid);
}
SetPlayerPos(playerid,CPs[cpid][EnterX],CPs[cpid][EnterY],CPs[cpid][EnterZ]);
if(CPs[cpid][EnterA] != 0.0) SetPlayerFacingAngle(playerid,CPs[cpid][EnterA]);
SetPlayerInterior(playerid,CPs[cpid][EnterInt]);
GameTextForPlayer(playerid,CPs[cpid][ExitingText],5000,3);
MultipleEnter[playerid] = -1;
CheckPointing[playerid] = 0;
SetTimerEx("EnableCheckpointingAgain",5000,0,"i",playerid);
}
else if(GetDistanceToClosestOutside(playerid) < 1.0) // Man geht wo rein
{
cpid = GetClosestOutsideID(playerid);
SetPlayerPos(playerid,CPs[cpid][ExitX],CPs[cpid][ExitY],CPs[cpid][ExitZ]);
if(CPs[cpid][ExitA] != 0.0) SetPlayerFacingAngle(playerid,CPs[cpid][ExitA]);
SetPlayerInterior(playerid,CPs[cpid][ExitInt]);
GameTextForPlayer(playerid,CPs[cpid][EnteringText],5000,3);
GivePlayerMoney(playerid,-CPs[cpid][EnteringPrice]);
if( !strcmp(CPs[cpid][EnteringText],CLUCKIN_BELL_TEXT) ||
!strcmp(CPs[cpid][EnteringText],PIZZA_TEXT) ||
!strcmp(CPs[cpid][EnteringText],BURGER_SHOT_TEXT) ||
!strcmp(CPs[cpid][EnteringText],"24/7"))
{
MultipleEnter[playerid] = cpid;
}
CheckPointing[playerid] = 0;
SetTimerEx("EnableCheckpointingAgain",5000,0,"i",playerid);
}
return 1;
}
//am Ende
public StreamCheckpoints()
{
for(new i; i<GetMaxPlayers(); i++)
{
if(IsPlayerConnected(i))
{
if(CheckPointShown[i] == 1)
{
DisablePlayerCheckpoint(i);
CheckPointShown[i] = 0;
}
if(DisplayForPlayer(i))
{
if(GetDistanceToClosestInside(i) < GetDistanceToClosestOutside(i) && GetDistanceToClosestInside(i) < 15.0)
{
new cpid = GetClosestInsideID(i);
SetPlayerCheckpoint(i,CPs[cpid][ExitX],CPs[cpid][ExitY],CPs[cpid][ExitZ],1.5);
CheckPointShown[i] = 1;
}
if(GetDistanceToClosestOutside(i) < GetDistanceToClosestInside(i) && GetDistanceToClosestOutside(i) < 15.0)
{
new cpid = GetClosestOutsideID(i);
SetPlayerCheckpoint(i,CPs[cpid][EnterX],CPs[cpid][EnterY],CPs[cpid][EnterZ],1.5);
CheckPointShown[i] = 1;
}
}
}
}
return 1;
}
public Float:GetDistanceToClosestInside
(playerid)
{
new Float:SmallestDistance = 99999.9, Float:OldDistance;
for(new cpid; cpid<sizeof(CPs); cpid++)
{
OldDistance = GetDistanceToInsideCheckpoint(playerid,cpid);
if(OldDistance < SmallestDistance)
{
SmallestDistance = OldDistance;
}
}
return SmallestDistance;
}
public Float:GetDistanceToClosestOutside(playerid)
{
new Float:SmallestDistance = 99999.9, Float:OldDistance;
for(new cpid; cpid<sizeof(CPs); cpid++)
{
OldDistance = GetDistanceToOutsideCheckpoint(playerid,cpid);
if(OldDistance < SmallestDistance)
{
SmallestDistance = OldDistance;
}
}
return SmallestDistance;
}
stock GetClosestInsideID(playerid)
{
new Float:SmallestDistance = 99999.9, Float:OldDistance, returnid;
for(new cpid; cpid<sizeof(CPs); cpid++)
{
OldDistance = GetDistanceToInsideCheckpoint(playerid,cpid);
if(OldDistance < SmallestDistance)
{
SmallestDistance = OldDistance;
returnid = cpid;
}
}
return returnid;
}
stock GetClosestOutsideID(playerid)
{
new Float:SmallestDistance = 99999.9, Float:OldDistance, returnid;
for(new cpid; cpid<sizeof(CPs); cpid++)
{
OldDistance = GetDistanceToOutsideCheckpoint(playerid,cpid);
if(OldDistance < SmallestDistance)
{
SmallestDistance = OldDistance;
returnid = cpid;
}
}
return returnid;
}
public Float:GetDistanceToInsideCheckpoint(playerid,checkpointid)
{
new Float:cpx1,Float:cpy1,Float:cpz1,Float:cpx2,Float:cpy2,Float:cpz2;
GetPlayerPos(playerid,cpx1,cpy1,cpz1);
cpx2 = CPs[checkpointid][ExitX];
cpy2 = CPs[checkpointid][ExitY];
cpz2 = CPs[checkpointid][ExitZ];
return floatsqroot(floatpower(floatabs(floatsub(cpx2,cpx1)),2)+floatpower(floatabs(floatsub(cpy2,cpy1)),2)+floatpower(floatabs(floatsub(cpz2,cpz1)),2));
}
public Float:GetDistanceToOutsideCheckpoint(playerid,checkpointid)
{
new Float:cpx1,Float:cpy1,Float:cpz1,Float:cpx2,Float:cpy2,Float:cpz2;
GetPlayerPos(playerid,cpx1,cpy1,cpz1);
cpx2 = CPs[checkpointid][EnterX];
cpy2 = CPs[checkpointid][EnterY];
cpz2 = CPs[checkpointid][EnterZ];
return floatsqroot(floatpower(floatabs(floatsub(cpx2,cpx1)),2)+floatpower(floatabs(floatsub(cpy2,cpy1)),2)+floatpower(floatabs(floatsub(cpz2,cpz1)),2));
}
public EnableCheckpointingAgain(playerid)
{
CheckPointing[playerid] = 1;
}
stock DisplayForPlayer(playerid)
{
if(GetPlayerState(playerid) != PLAYER_STATE_ONFOOT)
{
return 0;
}
if(PlayerInfo[playerid][pMember] == 4 || PlayerInfo[playerid][pLeader] == 4)
if(JobDuty[playerid] > 0)
{
return 0;
}
if(PlayerInfo[playerid][pMember] == 10 || PlayerInfo[playerid][pLeader] == 10 || PlayerInfo[playerid][pJob] == 14)
if(TransportDuty[playerid] > 0)
{
return 0;
}
return 1;
}
wo ist der fehler