//Global
static VariableCP[17];
//en OnFilterScriptInit
VariableCP[0]=CreateDynamicCP(..., 2.0, -1, -1, -1, 3.0);
VariableCP[1]=CreateDynamicCP(..., 1.0, -1, -1, -1, 3.0);
VariableCP[2]=CreateDynamicCP(..., 4.0, -1, -1, -1, 3.0);
VariableCP[3]=CreateDynamicCP(..., 5.0, -1, -1, -1, 3.0);
VariableCP[4]=CreateDynamicCP(..., 8.0, -1, -1, -1, 3.0);
VariableCP[5]=CreateDynamicCP(..., 4.0, -1, -1, -1, 3.0);
VariableCP[6]=CreateDynamicCP(..., 3.0, -1, -1, -1, 3.0);
VariableCP[7]=CreateDynamicCP(..., 6.0, -1, -1, -1, 3.0);
VariableCP[8]=CreateDynamicCP(..., 2.0, -1, -1, -1, 3.0); // ---
VariableCP[9]=CreateDynamicCP(..., 2.0, -1, -1, -1, 3.0); // ---
VariableCP[10]=CreateDynamicCP(..., 2.0, -1, -1, -1, 3.0); // ---
VariableCP[11]=CreateDynamicCP(..., 2.0, -1, -1, -1, 3.0); // ---
VariableCP[12]=CreateDynamicCP(..., 2.0, -1, -1, -1, 3.0); // ---
VariableCP[13]=CreateDynamicCP(..., 2.0, -1, -1, -1, 3.0); // ---
VariableCP[14]=CreateDynamicCP(..., 2.0, -1, -1, -1, 3.0); // ---
VariableCP[15]=CreateDynamicCP(..., 2.0, -1, -1, -1, 3.0); // ---
VariableCP[16]=CreateDynamicCP(..., 10.0, -1, -1, -1, 3.0);
//en OnPlayerKeyStateChange
if(pressed(KEY_HANDBRAKE) && GetPlayerState(playerid)==PLAYER_STATE_ONFOOT) {
for(new index=8; index<16; index++) { //Funciona...
printf("paso bucle Ferfecto: %d", index); //Funciona...
if(!IsPlayerInDynamicCP(playerid, VariableCP[index])) continue; //Funciona...
printf("paso !IsPlayerInDynamicCP Ferfecto: %d", index); //Funciona...
if(IsPlayerInDynamicCP(playerid, VariableCP[index])) { //Aca No pasa y eso ke estoy en Los CP
printf("paso Funcion: %d", index);
//FUNCION
}
}
}
for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
{
//Bucle por todos los posibles jugadores
//Condiciуn: si no esta conectado 'playerid', continue a la siguiente repeticiуn
if(!IsPlayerConnected(playerid)) continue;
//Aquн en adelante se ejecutarб si 'playerid' esta conectado (la condiciуn anterior)
if(IsPlayerConnected(playerid))
{
//Si 'playerid' esta conectado
}
//Segundo 'if' es innecesario, ya que ese cуdigo solo se ejecutarб si el jugador esta conectado
}
La ъltima comprobaciуn no es necesaria.
pawn Код:
|
if(pressed(KEY_HANDBRAKE) && GetPlayerState(playerid)==PLAYER_STATE_ONFOOT) {
for(new index=8; index<16; index++) {
if(!IsPlayerInDynamicCP(playerid, VariableCP[index])) continue;
printf("paso !IsPlayerInDynamicCP Ferfecto: %d", index); //Dices que esta te funciona perfectamente
if(IsPlayerInDynamicCP(playerid, VariableCP[index])) { //Pero esta no, por lo que esta condiciуn era la del problema
printf("paso Funcion: %d", index);
//FUNCION
}
}
}
No tiene lуgica, dices que no funciona como quieres, te dije lo que era y me dices que aun asi no responde pero sin embargo colocas en el cуdigo que antes de eso funciona perfectamente. Cito.
pawn Код:
|
La funciуn "IsPlayerInDynamicCP" no te funciona en ese cуdigo, deberбs crear una propia para comprobar si esta en el checkpoint o nу.
|
new checkpointID[MAX_PLAYERS];
public OnPlayerConnected(playerid)
{
checkpointID[playerid] = -1;
return 1;
}
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
checkpointID[playerid] = checkpointid;
return 1;
}
public OnPlayerLeaveDynamicCP(playerid, checkpointid)
{
checkpointID[playerid] = -1;
return 1;
}
stock /*bool:*/EstaEnCheckpoint(jugadorid, checkpointid)
{
return ((checkpointID[jugadorid] == checkpointid) ? (/*true*/1) : (/*false*/0));
}
#define EstaEnCheckpoint(%0,%1) ((checkpointID[%0] == %1) ? (/*true*/1) : (/*false*/0))