CreateDynamicCP and OnPlayerEnterDynamicCP -
dan40o - 04.01.2015
Why doesn't want to create a checkpoint? I am using plugin streamer by incognito:
Код:
CMD:work(playerid, params[])
{
if(startedwork[playerid] == 0)
{
startedwork[playerid] = 1;
stockinthetrunk[playerid] = 0;
new Random = random(sizeof(LoadStocks));
goforstocks[playerid] = CreateDynamicCP(LoadStocks[Random][0], LoadStocks[Random][1], LoadStocks[Random][2], 6.25, 0, 0, playerid, 100.0);
SendClientMessage(playerid, YELLOW, "Go to the RED Checkpoint on the minimap to Load your truck);
}
return 1;
}
Код:
new Float:LoadStocks[2][3] =
{
{2787.2947,2561.6282,9.7036},{2797.5291,2573.0210,10.5252}
};
Re: CreateDynamicCP and OnPlayerEnterDynamicCP -
Boot - 04.01.2015
To show or hide a checkpoint to a specific player, you have to use the following functions:
pawn Код:
native TogglePlayerDynamicRaceCP(playerid, checkpointid, toggle);
native TogglePlayerAllDynamicRaceCPs(playerid, toggle);
Re: CreateDynamicCP and OnPlayerEnterDynamicCP -
dan40o - 04.01.2015
Can you explain a little bit.?
Re: CreateDynamicCP and OnPlayerEnterDynamicCP -
Boot - 04.01.2015
Quote:
Originally Posted by dan40o
Can you explain a little bit.?
|
Sure.
If you wish to show or hide a checkpoint to a player, use the following function:
pawn Код:
native TogglePlayerDynamicCP(playerid, checkpointid, toggle);
playerid - The player ID.
checkpointid - The ID of the checkpoint. Remember to store the checkpoint ID in a variable.
Toggle - This paramter can be setted to FALSE or TRUE. If false, the checkpoint will be disabled to the player. If true, it will be enabled.
Now, if you want to show or hideALL checkpoints to a player, use the following function:
pawn Код:
native TogglePlayerAllDynamicCPs(playerid, toggle);
playerid - The player ID.
toggle - If true it will show ALL checkpoints to the players. If false will hide ALL checkpoints to the player.
If you have questions, please tell me. And sorry for bad english.
Re: CreateDynamicCP and OnPlayerEnterDynamicCP -
dan40o - 04.01.2015
Thanks.
So my code have to be:
Код:
goforstocks[playerid] = CreateDynamicCP(LoadStocks[Random][0], LoadStocks[Random][1], LoadStocks[Random][2], 6.25, 0, 0, playerid, 100.0);
TogglePlayerDynamicCP(playerid, goforstocks[playerid], true)
is it right?
Re: CreateDynamicCP and OnPlayerEnterDynamicCP -
Boot - 04.01.2015
Quote:
Originally Posted by dan40o
Thanks.
So my code have to be:
Код:
goforstocks[playerid] = CreateDynamicCP(LoadStocks[Random][0], LoadStocks[Random][1], LoadStocks[Random][2], 6.25, 0, 0, playerid, 100.0);
TogglePlayerDynamicCP(playerid, goforstocks[playerid], true)
is it right?
|
Yes, but it will be better if you do like this:
pawn Код:
//On top:
new Checkwork; // Our global variable.
// Publics:
public OnGameModeInit() // Let's create a checkpoint on this public and store its ID in a global variable.
{
Checkwork = CreateDynamicCP(LoadStocks[Random][0], LoadStocks[Random][1], LoadStocks[Random][2], 6.25, 0, 0, playerid, 100.0);
//...
return 1;
}
Now you can create your command:
pawn Код:
CMD:work(playerid, params[])
{
if(startedwork[playerid] == 0)
{
startedwork[playerid] = 1;
stockinthetrunk[playerid] = 0;
new Random = random(sizeof(LoadStocks));
TogglePlayerDynamicCP(playerid, Checkwork, true); // Showing the checkpoint to the player.
SendClientMessage(playerid, YELLOW, "Go to the RED Checkpoint on the minimap to Load your truck);
}
return 1;
}
Re: CreateDynamicCP and OnPlayerEnterDynamicCP -
dan40o - 05.01.2015
Thanks. REP+ : )
Re: CreateDynamicCP and OnPlayerEnterDynamicCP -
dan40o - 05.01.2015
Still doesn't create a checkpoint......
Re: CreateDynamicCP and OnPlayerEnterDynamicCP -
ikkentim - 05.01.2015
@Boot please do some research before you talk rubbish. There is no such thing as playerid in OnGameModeInit. Instead of playerid, use -1 to display the checkpoint to all players.
edit: the reason the checkpoints don't show up is: checkpoints cant be placed on server-objects, only on GTA-SA objects that exist by default. The coordinates of the checkpoints you show in your original post are outside of the original SA island and will therefore not work.
Re: CreateDynamicCP and OnPlayerEnterDynamicCP -
dan40o - 05.01.2015
Quote:
Originally Posted by ikkentim
@Boot please do some research before you talk rubbish. There is no such thing as playerid in OnGameModeInit. Instead of playerid, use -1 to display the checkpoint to all players.
edit: the reason the checkpoints don't show up is: checkpoints cant be placed on server-objects, only on GTA-SA objects that exist by default. The coordinates of the checkpoints you show in your original post are outside of the original SA island and will therefore not work.
|
I need checkpoint for each player. btw: the coordinates are OK. I've save them via ./save in the game. They are from original samp map.