Dynamic CheckPoint [Rep++] -
nezo2001 - 29.01.2015
I made this code
PHP код:
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
if(checkpointid == cp1)
{
DestroyDynamicCP(cp1);
RemovePlayerMapIcon(playerid, i1);
i2 = SetPlayerMapIcon(playerid, 1, 2380.4260,-1366.8895,24.0000, 0, COLOR_RED, MAPICON_GLOBAL);
SendClientMessage(playerid, COLOR_ORANGE, "Go to the next checkpoint");
cp2 = CreateDynamicCP(2380.4260,-1366.8895,24.0000,3, -1, -1, playerid, 100.0);
return 1;
}
if(checkpointid == cp2)
{
DestroyDynamicCP(cp2);
RemovePlayerMapIcon(playerid, i2);
i3 = SetPlayerMapIcon(playerid, 1, 2808.4329,-1189.1318,25.3388, 0, COLOR_RED, MAPICON_GLOBAL);
cp3 = CreateDynamicCP(2808.4329,-1189.1318,25.3380, 3, -1, -1, playerid, 100.0);
SendClientMessage(playerid, COLOR_ORANGE, "Go to the next checkpoint");
return 1;
}
if(checkpointid == cp3)
{
DestroyDynamicCP(cp3);
RemovePlayerMapIcon(playerid, i3);
i4 = SetPlayerMapIcon(playerid, 1, 2487.9919,-1139.2998,38.4384, 0, COLOR_RED, MAPICON_GLOBAL);
cp4 = CreateDynamicCP(2487.9919,-1139.2998,38.4384, 3, -1, -1, playerid, 100.0);
SendClientMessage(playerid, COLOR_ORANGE, "Go to the next checkpoint");
return 1;
}
if(checkpointid == cp4)
{
DestroyDynamicCP(cp4);
RemovePlayerMapIcon(playerid, i4);
i5 = SetPlayerMapIcon(playerid, 1, 1270.8938,-1156.5397,23.8281, 0, COLOR_RED, MAPICON_GLOBAL);
cp5 = CreateDynamicCP(1270.8938,-1156.5397,23.8281, 3, -1, -1, playerid, 100.0);
SendClientMessage(playerid, COLOR_ORANGE, "Go to the next checkpoint");
return 1;
}
if(checkpointid == cp5)
{
DestroyDynamicCP(cp5);
RemovePlayerMapIcon(playerid, i5);
i6 = SetPlayerMapIcon(playerid, 1, 2099.3909,-1807.4417,13.1019, 0, COLOR_RED, MAPICON_GLOBAL);
cp6 = CreateDynamicCP(2099.3909,-1807.4417,13.1019, 3, -1, -1, playerid, 100.0);
SendClientMessage(playerid, COLOR_ORANGE, "Now, Return back to the shop !");
return 1;
}
if(checkpointid == cp6)
{
DestroyDynamicCP(cp6);
RemovePlayerMapIcon(playerid, i6);
SendClientMessage(playerid, COLOR_RED, "Good job, Now here is some moeny !");
GivePlayerMoney(playerid, 2000);
return 1;
}
return 1;
}
But when i enter the second checkpoint it didn't destroy and still apear and all the code under it happen 20 time and the code under it doesn't work .
Hope u understand.
Please Help
!!
Re: Dynamic CheckPoint [Rep++] -
GGW - 29.01.2015
OnGameModeInit
pawn Код:
cp1 = CreateDynamicCP(/* the coords */,3, -1, -1, playerid, 100.0);
cp2 = CreateDynamicCP(2380.4260,-1366.8895,24.0000,3, -1, -1, playerid, 100.0);
cp3 = CreateDynamicCP(2808.4329,-1189.1318,25.3380, 3, -1, -1, playerid, 100.0);
cp4 = CreateDynamicCP(2487.9919,-1139.2998,38.4384, 3, -1, -1, playerid, 100.0);
cp5 = CreateDynamicCP(1270.8938,-1156.5397,23.8281, 3, -1, -1, playerid, 100.0);
cp6 = CreateDynamicCP(2099.3909,-1807.4417,13.1019, 3, -1, -1, playerid, 100.0);
And Change Your OnplayerEnterDynamicCp To This
pawn Код:
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
if(checkpointid == cp1)
{
TogglePlayerDynamicCP(playerid, cp1, 0);
TogglePlayerDynamicCP(playerid, cp2, 1);
RemovePlayerMapIcon(playerid, i1);
i2 = SetPlayerMapIcon(playerid, 1, 2380.4260,-1366.8895,24.0000, 0, COLOR_RED, MAPICON_GLOBAL);
SendClientMessage(playerid, COLOR_ORANGE, "Go to the next checkpoint");
}
else if(checkpointid == cp2)
{
TogglePlayerDynamicCP(playerid, cp2, 0);
TogglePlayerDynamicCP(playerid, cp3, 1);
RemovePlayerMapIcon(playerid, i2);
i3 = SetPlayerMapIcon(playerid, 1, 2808.4329,-1189.1318,25.3388, 0, COLOR_RED, MAPICON_GLOBAL);
SendClientMessage(playerid, COLOR_ORANGE, "Go to the next checkpoint");
}
else if(checkpointid == cp3)
{
TogglePlayerDynamicCP(playerid, cp3, 0);
TogglePlayerDynamicCP(playerid, cp4, 1);
RemovePlayerMapIcon(playerid, i3);
i4 = SetPlayerMapIcon(playerid, 1, 2487.9919,-1139.2998,38.4384, 0, COLOR_RED, MAPICON_GLOBAL);
SendClientMessage(playerid, COLOR_ORANGE, "Go to the next checkpoint");
}
else if(checkpointid == cp4)
{
TogglePlayerDynamicCP(playerid, cp4, 0);
TogglePlayerDynamicCP(playerid, cp5, 1);
RemovePlayerMapIcon(playerid, i4);
i5 = SetPlayerMapIcon(playerid, 1, 1270.8938,-1156.5397,23.8281, 0, COLOR_RED, MAPICON_GLOBAL);
SendClientMessage(playerid, COLOR_ORANGE, "Go to the next checkpoint");
}
else if(checkpointid == cp5)
{
TogglePlayerDynamicCP(playerid, cp5, 0);
TogglePlayerDynamicCP(playerid, cp6, 1);
RemovePlayerMapIcon(playerid, i5);
i6 = SetPlayerMapIcon(playerid, 1, 2099.3909,-1807.4417,13.1019, 0, COLOR_RED, MAPICON_GLOBAL);
SendClientMessage(playerid, COLOR_ORANGE, "Now, Return back to the shop !");
}
else if(checkpointid == cp6)
{
TogglePlayerDynamicCP(playerid, cp5, 0);
TogglePlayerDynamicCP(playerid, cp6, 0);
GivePlayerMoney(playerid, 2000);
RemovePlayerMapIcon(playerid, i6);
SendClientMessage(playerid, COLOR_RED, "Good job, Now here is some moeny !");
}
return 1;
}
Re: Dynamic CheckPoint [Rep++] -
nezo2001 - 29.01.2015
I can't use playerid in OnGameModint
Re: Dynamic CheckPoint [Rep++] -
ATGOggy - 29.01.2015
Btw, make these CP ids player specific.
Like cp1[playerid], cp2[playerid],...............
Re: Dynamic CheckPoint [Rep++] -
nezo2001 - 29.01.2015
If i use it under onplayerconnect it will show all the time not when the player start the job because it shows by a command
Re: Dynamic CheckPoint [Rep++] -
GGW - 29.01.2015
ohh sorry , My Bad
you can change it like this :
pawn Код:
cp2 = CreateDynamicCP(/* coords */, 2.0);
For Example
pawn Код:
cp5 = CreateDynamicCP(1270.8938,-1156.5397,23.8281, 2.0);
and onplayerconnect
pawn Код:
TogglePlayerDynamicCP(playerid, cp1, 0);
TogglePlayerDynamicCP(playerid, cp2, 0);
TogglePlayerDynamicCP(playerid, cp3, 0);
and the work cmd use this to show the first dynamicCP
pawn Код:
TogglePlayerDynamicCP(playerid, cp1, 1);
Re: Dynamic CheckPoint [Rep++] -
ATGOggy - 29.01.2015
Can you explain some more of the situation?
Re: Dynamic CheckPoint [Rep++] -
nezo2001 - 29.01.2015
Okai i made this command to start work
PHP код:
CMD:pizza(playerid, params[])
{
if(PlayerInfo[playerid][pJob] != pizza) return SendClientMessage(playerid, COLOR_RED, "You are not a part from pizza company");
if(!IsPlayerInVehicle(playerid, pc1) && !IsPlayerInVehicle(playerid, pc2) && !IsPlayerInVehicle(playerid, pc3) && !IsPlayerInVehicle(playerid, pc4) && !IsPlayerInVehicle(playerid, pc5) && !IsPlayerInVehicle(playerid, pc6) && !IsPlayerInVehicle(playerid, pc7) && !IsPlayerInVehicle(playerid, pc8)) return SendClientMessage(playerid, COLOR_RED, "You are not in any pizza's company car !");
cp1 = CreateDynamicCP(2148.9041,-1433.6654,25.5391,3, -1, -1, playerid, 100.0);
i1 = SetPlayerMapIcon(playerid, 1, 2148.9041, -1433.6654, 25.5391, 0, COLOR_RED, MAPICON_GLOBAL);
SendClientMessage(playerid, COLOR_ORANGE, "Go to the checkpoint and deliver the pizza");
return 1;
}
And when i enter the first checkpoint i works well but when i enter the second it send for me the message but didn't remove the marker and didn't destroy the checkpoint
Re: Dynamic CheckPoint [Rep++] -
ATGOggy - 29.01.2015
Were you testing this with any of your friend?
Also, make all variables player specific like I said in my previous post.
Re: Dynamic CheckPoint [Rep++] -
nezo2001 - 29.01.2015
Why ?