[AJUDA] Erro ao compilar (/pagarmulta) -
Bielz - 21.05.2011
Quando vou compilar aparece:
warning: 235: public function lacks forward declaration (symbol "GetPlayerGP")
error: 004: function "PlayerToPoint" is not implemented
error: 030: compound statement not closed at the end of file (started at line 116)
Код:
forward GivePlayerGP(playerid, gp);
new Multa[MAX_PLAYERS];
forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
new GP[MAX_PLAYERS];
new multatimer;
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_YELLOW2 0xF5DEB3AA
#define COLOR_OOC 0xB1C8FBAA
forward DetranCheck();
new MoneyMessage[MAX_PLAYERS];
forward GameModeExitFunc();
forward settime(playerid);
new gPlayerCheckpointStatus[MAX_PLAYERS];
forward GameModeInitExitFunc();
public GetPlayerGP(playerid)
{
return GP[playerid];
}
public GivePlayerGP(playerid, gp)
{
GP[playerid] += gp;
return 1;
}
public DetranCheck()
{
new string[256];
for(new j = 0; j < MAX_PLAYERS; j++)
{
if(Multa[j] > 1)
{
SendClientMessage(j, COLOR_OOC, "Vocк estб devendo o DETRAN, vocк deve pagar suas multas atй o prуximo pagamento para nгo ser preso.");
}
if(GetPlayerGP(j) < 0)
{
if(MoneyMessage[j]==0)
{
format(string, sizeof(string), "Vocк estб em dнvida, vocк deve recuperar o dinheiro perdido atй o prуximo pagamento para nгo ser preso.", GetPlayerGP(j));
SendClientMessage(j, COLOR_OOC, string);
MoneyMessage[j] = 1;
}
}
else
{
MoneyMessage[j] = 0;
}
}
}
public GameModeExitFunc()
{
KillTimer(multatimer);
GameModeExit();
}
public OnGameModeInit() {
multatimer = SetTimer("DetranCheck", 180000, 1);
}
strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
new string[256];
new playermoney;
new sendername[MAX_PLAYER_NAME];
new giveplayer[MAX_PLAYER_NAME];
new playername[MAX_PLAYER_NAME];
new cmd[256];
new tmp[256];
new giveplayerid, moneys, idx;
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/pagarmulta", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(!PlayerToPoint(4.0, playerid, 249.56, 67.87, 1003.64))
{
SendClientMessage(playerid, COLOR_GREY, "Vocк precisa estar no balcгo da DP para pagar uma multa!");
return 1;
}
else
{
if(Multa[playerid] == 0)
{
SendClientMessage(playerid, COLOR_YELLOW, "Vocк nгo tem uma multa pra pagar!");
return 1;
}
else if(Multa[playerid] == 1)
{
SendClientMessage(playerid, COLOR_YELLOW, "Vocк pagou 1 multa no valor de R$100.");
Multa[playerid] -= 1;
GivePlayerGP(playerid, -100);
}
else if(Multa[playerid] == 2)
{
SendClientMessage(playerid, COLOR_YELLOW, "Vocк pagou 2 multas no valor de R$200.");
Multa[playerid] = 0;
GivePlayerGP(playerid, -200);
}
else if(Multa[playerid] == 3)
{
SendClientMessage(playerid, COLOR_YELLOW, "Vocк pagou 3 multas no valor de R$300.");
Multa[playerid] = 0;
GivePlayerGP(playerid, -300);
}
else if(Multa[playerid] == 4)
{
SendClientMessage(playerid, COLOR_YELLOW, "Vocк pagou 4 multas no valor de R$400.");
Multa[playerid] = 0;
GivePlayerGP(playerid, -400);
}
else if(Multa[playerid] == 5)
{
SendClientMessage(playerid, COLOR_YELLOW, "Vocк pagou 5 multas no valor de R$500.");
Multa[playerid] = 0;
GivePlayerGP(playerid, -500);
}
Re: [AJUDA] Erro ao compilar (/pagarmulta) -
ViniBorn - 21.05.2011
Vocк nгo tem a funзгo PlayerToPoint e falta > forward GetPlayerGP(playerid);
Re: [AJUDA] Erro ao compilar (/pagarmulta) -
Shadoww5 - 21.05.2011
Vocк nгo declarou a foward. Entгo coloque o codigo abaixo no topo do seu GM:
PHP код:
forward GetPlayerGP(playerid);
E quanto ao PlayerToPoint, adicione isto no final do seu GM:
PHP код:
public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
if(IsPlayerConnected(playerid))
{
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
tempposx = (oldposx -x);
tempposy = (oldposy -y);
tempposz = (oldposz -z);
if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
return 1;
}
}
return 0;
}
Re: [AJUDA] Erro ao compilar (/pagarmulta) -
deregudegu - 21.05.2011
Se fizer isso acima, nгo esqueзa da forward:
pawn Код:
forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
Re: [AJUDA] Erro ao compilar (/pagarmulta) -
Shadoww5 - 21.05.2011
Ja tem uma forward dessa la emcima.
Re: [AJUDA] Erro ao compilar (/pagarmulta) -
Bielz - 21.05.2011
Fiz isso e agora deu isso D:
error: 004: function "PlayerToPoint" is not implemented
warning: 217: loose indentation
error: 029: invalid expression, assumed zero
error: 004: function "PlayerToPoint" is not implemented
error: 017: undefined symbol "x"
error: 017: undefined symbol "y"
error: 017: undefined symbol "z"
error: 017: undefined symbol "radi"
error: 030: compound statement not closed at the end of file (started at line 121)
Re: [AJUDA] Erro ao compilar (/pagarmulta) -
Shadoww5 - 21.05.2011
So falta voce mandar as linhas que ocorrem os erros. Nao acha ?
Re: [AJUDA] Erro ao compilar (/pagarmulta) -
Bielz - 21.05.2011
Код:
if(!PlayerToPoint(4.0, playerid, 249.56, 67.87, 1003.64)) - linha: 135
public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z) - linha 212
tempposx = (oldposx -x); - linha 219
tempposy = (oldposy -y); - linha 220
tempposz = (oldposz -z); - linha 221
if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi))) - linha 222
Re: [AJUDA] Erro ao compilar (/pagarmulta) -
Shadoww5 - 21.05.2011
Mel dels.
Basta mandar as LINHAS e SOMENTE as linhas que tem esses erros.
Aperta CTRL + H e digita a linha la. Entao manda pra nois.
Re: [AJUDA] Erro ao compilar (/pagarmulta) -
Bielz - 21.05.2011
Editei