SA-MP Forums Archive
[Ajuda]Sistema Level - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda]Sistema Level (/showthread.php?tid=237356)



[Ajuda]Sistema Level - =WoR=Bruno - 09.03.2011

Alguns jogadores evoluem mais rapido que outros,mesmo estando connectados o mesmo tempo.
Houve jogadores que passaram do Level 0 para o 2...e depois para o 4.

A unica coisa que mudei foi o OnPlayerUpdate para fazer o score aparecer no TAB

Код:
#include <a_samp>
#include <dini>


#define COR_AQUI      0xFFFFFFAA


new Level[MAX_PLAYERS];
new Respeito[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
	if(dini_Isset("levels.dkn",PlayerName(playerid))) Level[playerid] = (playerid,dini_Int("levels.dkn",PlayerName(playerid)));
	SetTimerEx("Timer",60000,true,"i",playerid);
	return 1;
}

forward Timer(playerid);
public Timer(playerid)
{
	Respeito[playerid]++;
	SendClientMessage(playerid,COR_AQUI,"Gratz,your respect has grown a bit more!!");
	if(Respeito[playerid] == 5)
	{
		Level[playerid]++;
		SendClientMessage(playerid,COR_AQUI,"Gratz,you leveled up!!");
		Level[playerid]++;
	}
	return 1;
}

public OnGameModeInit()
{
	if(!fexist("levels.dkn")) dini_Create("levels.dkn");
	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
	dini_IntSet("levels.dkn",PlayerName(playerid),Level[playerid]);
	return 1;
}

public OnPlayerUpdate(playerid)
{
    dini_IntSet("levels.dkn",PlayerName(playerid),Level[playerid]);
    if(dini_Isset("levels.dkn",PlayerName(playerid))) SetPlayerScore(playerid,dini_Int("levels.dkn",PlayerName(playerid)));
    return 1;
}

stock PlayerName(playerid)
{
	new PlayerNameLevel[MAX_PLAYERS];
	GetPlayerName(playerid, PlayerNameLevel, MAX_PLAYERS);
	return PlayerNameLevel;
}
Alguem me pode ajudar?


Re: [Ajuda]Sistema Level - JonathanFeitosa - 09.03.2011

pawn Код:
Level[playerid]++;
SendClientMessage(playerid,COR_AQUI,"Gratz,you leveled up!!");
Level[playerid]++;
Tenta trocar por apenas :
pawn Код:
Level[playerid]++;
SendClientMessage(playerid,COR_AQUI,"Gratz,you leveled up!!");



Re: [Ajuda]Sistema Level - leandro123456 - 09.03.2011

Quote:
Originally Posted by DonBruno
Посмотреть сообщение
public Timer(playerid)
{
Respeito[playerid]++;
SendClientMessage(playerid,COR_AQUI,"Gratz,your respect has grown a bit more!!");
if(Respeito[playerid] == 5)
{
Level[playerid]++;
SendClientMessage(playerid,COR_AQUI,"Gratz,you leveled up!!");
Level[playerid]++;
}
return 1;
}
Vocк estб dando o nivel duas vezes, apague a parte que eu coloquei em negrito


Re: [Ajuda]Sistema Level - Ricop522 - 09.03.2011

pawn Код:
forward Timer(playerid);
public Timer(playerid)
{
    Respeito[playerid]++;
    SendClientMessage(playerid,COR_AQUI,"Gratz,your respect has grown a bit more!!");
    if(Respeito[playerid] == 5)
    {
        SendClientMessage(playerid,COR_AQUI,"Gratz,you leveled up!!");
        Level[playerid]++;
    }
    return 1;
}



Re: [Ajuda]Sistema Level - zSuYaNw - 10.03.2011

pawn Код:
#include <a_samp>
#include <dini>


#define COR_AQUI      0xFFFFFFAA


new Level[MAX_PLAYERS];
new Respeito[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    if(dini_Isset("levels.dkn",PlayerName(playerid))) Level[playerid] = (playerid,dini_Int("levels.dkn",PlayerName(playerid)));
    SetTimerEx("Timer",60000,true,"d",playerid);
    return 1;
}

forward Timer(playerid);
public Timer(playerid)
{
    Respeito[playerid]++;
    SendClientMessage(playerid,COR_AQUI,"Gratz,your respect has grown a bit more!!");
    if(Respeito[playerid] == 5)
    {
        SendClientMessage(playerid,COR_AQUI,"Gratz,you leveled up!!");
    }
    return 1;
}

public OnGameModeInit()
{
    if(!fexist("levels.dkn")) dini_Create("levels.dkn");
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    dini_IntSet("levels.dkn",PlayerName(playerid),Level[playerid]);
    return 1;
}

public OnPlayerConnect(playerid)
{
    dini_IntSet("levels.dkn",PlayerName(playerid),Level[playerid]);
    if(dini_Isset("levels.dkn",PlayerName(playerid))) SetPlayerScore(playerid,dini_Int("levels.dkn",PlayerName(playerid)));
    return 1;
}

stock PlayerName(playerid)
{
    new PlayerNameLevel[MAX_PLAYERS];
    GetPlayerName(playerid, PlayerNameLevel, MAX_PLAYERS);
    return PlayerNameLevel;
}