Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <progress2>
- new PlayerText: TextDrawL;
- new PlayerBar: LevelBar;
- enum iPlayers
- {
- exp,
- level
- };
- new pInfo[MAX_PLAYERS][iPlayers];
- main()
- {
- print("\n----------------------------------");
- print(" Blank Gamemode by your name here");
- print("----------------------------------\n");
- }
- public OnGameModeInit()
- {
- // Don't use these lines if it's a filterscript
- SetGameModeText("Blank Script");
- AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
- return 1;
- }
- public OnPlayerRequestClass(playerid, classid)
- {
- SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
- SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
- SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- SetPlayerScore(playerid, 1);
- // Criando TD =-=-=-=-=-=-=-=-=-=
- TextDrawL = CreatePlayerTextDraw(playerid, 504.476257, 114.053321, "");
- PlayerTextDrawLetterSize(playerid, TextDrawL, 0.308952, 0.951466);
- PlayerTextDrawAlignment(playerid, TextDrawL, 1);
- PlayerTextDrawColor(playerid, TextDrawL, -1);
- PlayerTextDrawSetShadow(playerid, TextDrawL, 1);
- PlayerTextDrawSetOutline(playerid, TextDrawL, 0);
- PlayerTextDrawBackgroundColor(playerid, TextDrawL, 255);
- PlayerTextDrawFont(playerid, TextDrawL, 3);
- PlayerTextDrawSetProportional(playerid, TextDrawL, 1);
- PlayerTextDrawSetShadow(playerid, TextDrawL, 1);
- //
- // Bar
- LevelBar = CreatePlayerProgressBar(playerid, 504.00, 127.00, 100.50, 4.50, 12444671, 100.0);
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- GivePlayerWeapon(playerid, 26, 9999);
- pInfo[playerid][exp] = 1;
- pInfo[playerid][level] = GetPlayerScore(playerid);
- AtualizarBar(playerid);
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- PlayerTextDrawDestroy(playerid, TextDrawL);
- DestroyPlayerProgressBar(playerid, LevelBar);
- return 1;
- }
- // Add exp Por Level
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if (strcmp("/addexp", cmdtext, true, 10) == 0)
- {
- pInfo[playerid][exp]++;
- AtualizarBar(playerid);
- return 1;
- }
- return 0;
- }
- // Add exp Por Morte
- // pode colocar a quantidade que quiser
- // Exemplo : pInfo[killerid][exp]+10;
- public OnPlayerDeath(playerid, killerid, reason)
- {
- if(killerid != INVALID_PLAYER_ID)
- {
- pInfo[killerid][exp]++; // aqui é mais 1
- AtualizarBar(killerid);
- }
- return 1;
- }
- AtualizarBar(playerid)
- {
- new string[64], expAdd;
- if(pInfo[playerid][level] <= 4) expAdd = pInfo[playerid][level]*2;
- else if(pInfo[playerid][level] >= 5) expAdd = pInfo[playerid][level]*3;
- format(string, sizeof(string), "Level : %d [%d/%d]", pInfo[playerid][level], pInfo[playerid][exp], expAdd);
- PlayerTextDrawSetString(playerid, TextDrawL, string);
- PlayerTextDrawShow(playerid, TextDrawL);
- SetPlayerProgressBarMaxValue(playerid, LevelBar, expAdd);
- SetPlayerProgressBarValue(playerid, LevelBar, pInfo[playerid][exp]);
- ShowPlayerProgressBar(playerid, LevelBar);
- if(pInfo[playerid][exp] == expAdd)
- {
- pInfo[playerid][exp] = 0;
- pInfo[playerid][level]++;
- SetPlayerScore(playerid, GetPlayerScore(playerid) +1);
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement