public GetPlayerScoreEx(playerid)
{
new Float:score;
score = PlayersData[playerid][Puntos] / 10;
floatround(score, floatround_round);
return score; // Lнnea del error
}
enum Info
{
Puntos,
};
new PlayersData[MAX_PLAYERS][Info];
stock GetPlayerScoreEx(playerid)
{
new Float:score;
score = PlayersData[playerid][Puntos] / 10;
floatround(score, floatround_round);
return score;
}
enum DataUsers
{
Dinero,
Admin,
Puntos,
Score
}
new PlayersData[MAX_PLAYERS][DataUsers];
enum DataUsers
{
Dinero,
Admin,
Puntos,
Score
}
new PlayersData[MAX_PLAYERS][DataUsers];
forward Float:GetPlayerScoreEx(playerid);
public Float:GetPlayerScoreEx(playerid)
{
new Float:score;
score = PlayersData[playerid][Puntos] / 10;
floatround(score, floatround_round);
return score; // Lнnea del error
}
creo que el problema estб en eso, lo de cambiar Float: quizб sea depende de la funcionalidad que le vaya a tomar.
|
Pero tengo entendido que se aсadirнa el tag Float a la funciуn si esta retorna un valor del tipo Float, y floatround se supone que retorna un valor tipo Integer. їAlguien me explica esto por favor?
|

stock Vida0(playerid)
{
new Float:HP;
GetPlayerHealth(playerid, HP);
return _:HP;
}
stock Float:Vida1(playerid)
{
new Float:HP;
GetPlayerHealth(playerid, HP);
return HP;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
new string[128];
if (strcmp("/mivida", cmdtext, true, 10) == 0)
{
format(string, sizeof(string), "Float: Vida0 > %f, Vida1 > %f - Entero: Vida0 > %d, Vida1 > %d", Vida0(playerid), Vida1(playerid), Vida0(playerid), Vida1(playerid));
SendClientMessage(playerid, -1, string);
return 1;
}
return 0;
}
. siempre retornarб un flotante aunque no le pongas tag al stock creo yo.
public GetPlayerScoreEx(playerid)
{
new Float:score; // Declararemos que 'score' serб flotante.
score = PlayersData[playerid][Puntos] / 10;
floatround(score, floatround_round); // Aquн haremos que 'score' sea un entero.
return score; // Retornamos 'score', peeeero, como la funciуn no tiene el tag 'Float', pero la variable sн, darб errores.
}
stock GetPlayerScoreEx(playerid) // Ya sea 'public' o 'stock', siempre serб el mismo cуdigo. No cambia errores.
{
return floatround(PlayersData[playerid][Puntos]/10);
}
#define GetPlayerScoreEx(%1) floatround(PlayersData[%1][Puntos]/10)
|
Mencionarй tu error:
pawn Код:
Al usar 'floatround' no declararбs que el compilador tomarб esa variable como flotante, por lo que darб error. Soluciуn: pawn Код:
pawn Код:
Es solo simple lуgica. |
#define GetPlayerScoreEx(%1) floatround(PlayersData[playerid][Puntos]/10)
#define GetPlayerScoreEx(%0) floatround(PlayersData[%0][Puntos]/10)