forward Upar(playerid);
public Upar(playerid)
{
new str[256];
XP[playerid] ++;
if(XP[playerid] == 11)
{
new Score = GetPlayerScore(playerid);
SetPlayerScore(playerid,Score+3);
XP[playerid] = 0;
format(str, sizeof(str), "{90EE90}|UP|Vocк juntou 10 experiкncias, e ganhou +2 leveis.(Score atual: %i).", GetPlayerScore(playerid));
SendClientMessage(playerid, -1, str);
PlayerPlaySound(playerid,1149,0.0,0.0,0.0), GameTextForPlayer(playerid,"~w~Level ~p~UP!",5000,6);
return false;
}
format(str, sizeof(str), "{00EE76}|EXPERIКNCIA|Vocк ganhou +1 de experiкncia! (EXP: %i/10).", XP[playerid]);
GameTextForPlayer(playerid, "~w~+1 ~p~XP", 2000, 1);
SendClientMessage(playerid, -1, str);
PlayerPlaySound(playerid,1139,0.0,0.0,0.0), GameTextForPlayer(playerid,"+1 XP",5000,6);
return true;
}
tentei bota pra salvar mas deu uns erros
exptotal,
DOF2_SetInt(String,"TotalExps", Player[playerid][exptotal]);
Player[playerid][exptotal] = DOF2_GetInt(String, "TotalExps");
Bom galera peguei um sistema de experiкncia de xp aki no forum samp e botei no meu gm eu queria por para salva o xp de cada play
PHP код:
|
dcmd_meuxp(playerid, params[])
{
#pragma unused params
new dialogrande[600];
if(Player[playerid][pLogged] == false)
return SendClientMessage(playerid, COR_ERRO, "ERRO: Vocк nгo estб logado para utilizar este comando!");
format(dialogrande, 600, "%s {CDC9C9}Nome: %s\n", dialogrande, getPName(playerid));
format(dialogrande, 600, "%s {4EEE94}Level {FFFFFF}atual: %d\n",dialogrande, GetPlayerScore(playerid));
format(dialogrande, 600, "%s {6B8E23}Total de XP: (%d/10).\n", dialogrande, exptotal[playerid]); // aki eu queria por para conta quantos xp o play tem , mas quando desloga zera tudo
ShowPlayerDialog(playerid, DIALOG_CREDITOS, DIALOG_STYLE_MSGBOX, "{FFFFFF}» Seu level", dialogrande, "Sair", "");
return 1;
}
C:\Users\Henrique Guedes\Desktop\GameMode\gamemodes\gamemodehenrique.pwn(7811) : error 028: invalid subscript (not an array or too many subscripts): "exptotal" C:\Users\Henrique Guedes\Desktop\GameMode\gamemodes\gamemodehenrique.pwn(7811) : warning 215: expression has no effect C:\Users\Henrique Guedes\Desktop\GameMode\gamemodes\gamemodehenrique.pwn(7811) : error 001: expected token: ";", but found "]" C:\Users\Henrique Guedes\Desktop\GameMode\gamemodes\gamemodehenrique.pwn(7811) : error 029: invalid expression, assumed zero C:\Users\Henrique Guedes\Desktop\GameMode\gamemodes\gamemodehenrique.pwn(7811) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 4 Errors.
dcmd_meuxp(playerid, params[])
{
#pragma unused params
new dialogrande[600];
if(Player[playerid][pLogged] == false)
return SendClientMessage(playerid, COR_ERRO, "ERRO: Vocк nгo estб logado para utilizar este comando!");
format(dialogrande, 600, "%s {CDC9C9}Nome: %s\n", dialogrande, getPName(playerid));
format(dialogrande, 600, "%s {4EEE94}Level {FFFFFF}atual: %d\n",dialogrande, GetPlayerScore(playerid));
format(dialogrande, 600, "%s {6B8E23}Total de XP: (%d/10).\n", dialogrande, Player[playerid][exptotal]); // aki eu queria por para conta quantos xp o play tem , mas quando desloga zera tudo
ShowPlayerDialog(playerid, DIALOG_CREDITOS, DIALOG_STYLE_MSGBOX, "{FFFFFF}» Seu level", dialogrande, "Sair", "");
return 1;
}
PHP код:
Код:
C:\Users\Henrique Guedes\Desktop\GameMode\gamemodes\gamemodehenrique.pwn(7811) : error 028: invalid subscript (not an array or too many subscripts): "exptotal" C:\Users\Henrique Guedes\Desktop\GameMode\gamemodes\gamemodehenrique.pwn(7811) : warning 215: expression has no effect C:\Users\Henrique Guedes\Desktop\GameMode\gamemodes\gamemodehenrique.pwn(7811) : error 001: expected token: ";", but found "]" C:\Users\Henrique Guedes\Desktop\GameMode\gamemodes\gamemodehenrique.pwn(7811) : error 029: invalid expression, assumed zero C:\Users\Henrique Guedes\Desktop\GameMode\gamemodes\gamemodehenrique.pwn(7811) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 4 Errors. |
forward Upar(playerid);
public Upar(playerid)
{
new str[256];
XP[playerid] ++;
if(XP[playerid] == 11)
{
new Score = GetPlayerScore(playerid);
SetPlayerScore(playerid, Score+2);
XP[playerid] = 0;
format(str, sizeof(str), "{90EE90}|UP|Vocк juntou 10 experiкncias, e ganhou +2 leveis.(Score atual: %i).", GetPlayerScore(playerid));
SendClientMessage(playerid, -1, str);
PlayerPlaySound(playerid,1149,0.0,0.0,0.0);
GameTextForPlayer(playerid,"~w~Level ~p~UP!",5000,6)
}
else
{
format(str, sizeof(str), "{00EE76}|EXPERIКNCIA|Vocк ganhou +1 de experiкncia! (EXP: %i/10).", XP[playerid]);
GameTextForPlayer(playerid, "~w~+1 ~p~XP", 2000, 1);
SendClientMessage(playerid, -1, str);
PlayerPlaySound(playerid,1139,0.0,0.0,0.0);
GameTextForPlayer(playerid,"+1 XP",5000,6);
}
new contas[56], nomep[MAX_PLAYER_NAME];
GetPlayerName(playerid, nomep, sizeof(nomep));
format(contas, sizeof(contas), "Contas/%s.ini", nomep);
if(!DOF2_FileExists(contas)) return SendClientMessage(playerid, -1, "ERRO: Caray, maluco. Sua conta existe nгo.");
DOF2_SetInt(contas, "Level", GetPlayerScore(playerid));
DOF2_SetInt(contas, "XP", XP[playerid]);
DOF2_SaveFile();
return true;
}
//OnPlayerConnect ou Dialog de Login (onde vc quer que carregue os dados)
new contas[56], nomep[MAX_PLAYER_NAME];
GetPlayerName(playerid, nomep, sizeof(nomep));
format(contas, sizeof(contas), "Contas/%s.ini", nomep);
//if(!DOF2_FileExists(contas)) return SendClientMessage(playerid, -1, "ERRO: Caray, maluco. Sua conta existe nгo.");
SetPlayerScore(playerid, DOF2_GetInt(contas, "Level"));
XP[playerid] = DOF2_GetInt(contas, "XP");
//Comando
dcmd_meuxp(playerid, params[])
{
#pragma unused params
new deustopzissimo[600], deusetop[90];
if(Player[playerid][pLogged] == false)
return SendClientMessage(playerid, COR_ERRO, "ERRO: Vocк nгo estб logado para utilizar este comando!");
new nomep[MAX_PLAYER_NAME];
GetPlayerName(playerid, nomep, sizeof(nomep));
format(deusetop, sizeof(deusetop), "{CDC9C9}Nome: %s\n", nomep);
strcat(deustopzissimo, deusetop);
format(deusetop, sizeof(deusetop), "{4EEE94}Level {FFFFFF}atual: %d\n", GetPlayerScore(playerid));
strcat(deustopzissimo, deusetop);
format(deusetop, sizeof(deusetop), "{6B8E23}Total de XP: (%d/10).\n", XP[playerid]);
strcat(deustopzissimo, deusetop);
ShowPlayerDialog(playerid, DIALOG_CREDITOS, DIALOG_STYLE_MSGBOX, "{FFFFFF}» Seu level", deustopzissimo, "Sair", "");
return 1;
}
Fiz rapidinho aqui e nгo tentei compilar, mas qualquer coisa, me fala.
Tenta aн: PHP код:
|
C:\Users\Henrique Guedes\Desktop\GameMode\gamemodes\gamemodehenrique.pwn(7798) : error 001: expected token: ";", but found "}" C:\Users\Henrique Guedes\Desktop\GameMode\gamemodes\gamemodehenrique.pwn(17606) : error 036: empty statement C:\Users\Henrique Guedes\Desktop\GameMode\gamemodes\gamemodehenrique.pwn(17687) : error 017: undefined symbol "contas" C:\Users\Henrique Guedes\Desktop\GameMode\gamemodes\gamemodehenrique.pwn(17688) : error 017: undefined symbol "contas"
deu esses erros
Код:
C:\Users\Henrique Guedes\Desktop\GameMode\gamemodes\gamemodehenrique.pwn(7798) : error 001: expected token: ";", but found "}" C:\Users\Henrique Guedes\Desktop\GameMode\gamemodes\gamemodehenrique.pwn(17606) : error 036: empty statement C:\Users\Henrique Guedes\Desktop\GameMode\gamemodes\gamemodehenrique.pwn(17687) : error 017: undefined symbol "contas" C:\Users\Henrique Guedes\Desktop\GameMode\gamemodes\gamemodehenrique.pwn(17688) : error 017: undefined symbol "contas" |
forward Upar(playerid);
public Upar(playerid)
{
new str[256];
XP[playerid] ++;
if(XP[playerid] == 11)
{
new Score = GetPlayerScore(playerid);
SetPlayerScore(playerid, Score+2);
XP[playerid] = 0;
format(str, sizeof(str), "{90EE90}|UP|Vocк juntou 10 experiкncias, e ganhou +2 leveis.(Score atual: %i).", GetPlayerScore(playerid));
SendClientMessage(playerid, -1, str);
PlayerPlaySound(playerid,1149,0.0,0.0,0.0);
GameTextForPlayer(playerid,"~w~Level ~p~UP!",5000,6);
}
else
{
format(str, sizeof(str), "{00EE76}|EXPERIКNCIA|Vocк ganhou +1 de experiкncia! (EXP: %i/10).", XP[playerid]);
GameTextForPlayer(playerid, "~w~+1 ~p~XP", 2000, 1);
SendClientMessage(playerid, -1, str);
PlayerPlaySound(playerid,1139,0.0,0.0,0.0);
GameTextForPlayer(playerid,"+1 XP",5000,6);
}
new contas[56], nomep[MAX_PLAYER_NAME];
GetPlayerName(playerid, nomep, sizeof(nomep));
format(contas, sizeof(contas), "Contas/%s.ini", nomep);
if(!DOF2_FileExists(contas)) return SendClientMessage(playerid, -1, "ERRO: Caray, maluco. Sua conta existe nгo.");
DOF2_SetInt(contas, "Level", GetPlayerScore(playerid));
DOF2_SetInt(contas, "XP", XP[playerid]);
DOF2_SaveFile();
return true;
}
//OnPlayerConnect ou Dialog de Login (onde vc quer que carregue os dados)
new contas[56], nomep[MAX_PLAYER_NAME];
GetPlayerName(playerid, nomep, sizeof(nomep));
format(contas, sizeof(contas), "Contas/%s.ini", nomep);
//if(!DOF2_FileExists(contas)) return SendClientMessage(playerid, -1, "ERRO: Caray, maluco. Sua conta existe nгo.");
SetPlayerScore(playerid, DOF2_GetInt(contas, "Level"));
XP[playerid] = DOF2_GetInt(contas, "XP");
//Comando
dcmd_meuxp(playerid, params[])
{
#pragma unused params
new deustopzissimo[600], deusetop[90];
if(Player[playerid][pLogged] == false)
return SendClientMessage(playerid, COR_ERRO, "ERRO: Vocк nгo estб logado para utilizar este comando!");
new nomep[MAX_PLAYER_NAME];
GetPlayerName(playerid, nomep, sizeof(nomep));
format(deusetop, sizeof(deusetop), "{CDC9C9}Nome: %s\n", nomep);
strcat(deustopzissimo, deusetop);
format(deusetop, sizeof(deusetop), "{4EEE94}Level {FFFFFF}atual: %d\n", GetPlayerScore(playerid));
strcat(deustopzissimo, deusetop);
format(deusetop, sizeof(deusetop), "{6B8E23}Total de XP: (%d/10).\n", XP[playerid]);
strcat(deustopzissimo, deusetop);
ShowPlayerDialog(playerid, DIALOG_CREDITOS, DIALOG_STYLE_MSGBOX, "{FFFFFF}» Seu level", deustopzissimo, "Sair", "");
return 1;
}
PHP код:
|
Porque salvar a experiкncia ao jogador estar upando mais algum nнvel?
Nгo seria melhor salvar no OnPlayerDisconnect? Faзa os armazenamentos no OnPlayerConnect e OnPlayerDisconnect. Na OnGameModeExit, vocк apenas finaliza o uso do DOF2. PHP код:
|