Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- 888888888888888888888888888888888888888888
- 88 NADE-PARKOURING 88
- 888888888888888888888888888888888888888888
- 88 - AUTHOR: Badjouras 88
- 88 (aka hbzi @ forum.sa-mp.com) 88
- 88 - VERSION: 1.2 88
- 88 - LAST UPDATE: 15/07 88
- 888888888888888888888888888888888888888888
- 88 - CHANGELOG: 88
- 88 - Added time and attempt counters 88
- 888888888888888888888888888888888888888888
- */
- // * INCLUDES * //
- #include <a_samp>
- #include <core>
- #include <Dini>
- #include <float>
- #include <zcmd>
- // * DEFINES FUNCS * //
- #define Msg SendClientMessage
- #define MsgAll SendClientMessageToAll
- // * CONSTANTES * //
- #define MAX_FILES 100
- // * VARS * //
- new bool:isPark[MAX_PLAYERS+1] = false;
- new nivelPark[MAX_PLAYERS+1] = 1;
- new tentsPark[MAX_PLAYERS+1] = 0;
- new str[150];
- new timers[MAX_PLAYERS+1];
- new contador[2][MAX_PLAYERS+1];
- new Text:tempo[MAX_PLAYERS+1];
- new pFirstL[MAX_PLAYERS+1];
- // * STOCKS * //
- stock GetPlayerN(playerid)
- {
- new nomeJog[MAX_PLAYER_NAME];
- GetPlayerName(playerid, nomeJog, MAX_PLAYER_NAME);
- return nomeJog;
- }
- stock DarNadesVida(playerid)
- {
- ResetPlayerWeapons(playerid);
- GivePlayerWeapon(playerid, 16, 9999);
- SetPlayerHealth(playerid, 9999999);
- return 1;
- }
- stock FirstLevel(playerid)
- {
- pFirstL[playerid] = 1;
- format(str, sizeof(str), "You are now at level {00FF00}1{FFFFFF}!");
- Msg(playerid, -1, str);
- new tmps[64];
- format(tmps, sizeof(tmps), "parkour/1.txt");
- new Float:pos[7];
- pos[0] = dini_Float(tmps, "posIX");
- pos[1] = dini_Float(tmps, "posIY");
- pos[2] = dini_Float(tmps, "posIZ");
- pos[3] = dini_Float(tmps, "angI");
- pos[4] = dini_Float(tmps, "posFX");
- pos[5] = dini_Float(tmps, "posFY");
- pos[6] = dini_Float(tmps, "posFZ");
- SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
- SetPlayerFacingAngle(playerid, pos[3]);
- SetPlayerCheckpoint(playerid, pos[4], pos[5], pos[6], 1.5);
- DarNadesVida(playerid);
- //Iniciar contador
- timers[playerid] = SetTimerEx("TimeCount", 1000, 1, "d", playerid);
- return 1;
- }
- stock NextLevel(playerid)
- {
- new lvl = nivelPark[playerid];
- new tmps[64];
- format(tmps, sizeof(tmps), "parkour/%d.txt", lvl);
- if(!dini_Exists(tmps))
- {
- KillTimer(timers[playerid]);
- format(str, sizeof(str), "You did it to the {00FF00}last{FFFFFF} level. Congratulations!");
- Msg(playerid, -1, str);
- format(str, sizeof(str), "{00FF00}%s{FFFFFF} completed all levels in Nade Parkour ({00FF00}%d{FFFF00}m:{00FF00}%d{FFFF00}s - {00FF00}%d {FFFF00}attempts{FFFFFF})", GetPlayerN(playerid), contador[0][playerid], contador[1][playerid], tentsPark[playerid]);
- contador[0][playerid] = 0;
- contador[1][playerid] = 0;
- return MsgAll(-1, str);
- }
- format(str, sizeof(str), "You are now in level {00FF00}%d{FFFFFF}!", lvl);
- Msg(playerid, -1, str);
- new Float:pos[7];
- pos[0] = dini_Float(tmps, "posIX");
- pos[1] = dini_Float(tmps, "posIY");
- pos[2] = dini_Float(tmps, "posIZ");
- pos[3] = dini_Float(tmps, "angI");
- pos[4] = dini_Float(tmps, "posFX");
- pos[5] = dini_Float(tmps, "posFY");
- pos[6] = dini_Float(tmps, "posFZ");
- SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
- SetPlayerFacingAngle(playerid, pos[3]);
- SetPlayerCheckpoint(playerid, pos[4], pos[5], pos[6], 1.5);
- DarNadesVida(playerid);
- return 1;
- }
- // * CMDS * //
- CMD:nade(playerid, params[])
- {
- if(isPark[playerid] == false)
- {
- isPark[playerid] = true;
- format(str, sizeof(str), "{00FF00}%s{FFFFFF} entered the Nade Parkour ({00FF00}/nade{FFFFFF})", GetPlayerN(playerid));
- MsgAll(-1, str);
- format(str, sizeof(str), "Use {00FF00}/try{FFFFFF} to repeat the level if you fell!");
- Msg(playerid, -1, str);
- format(str, sizeof(str), "Use {00FF00}/exitnade{FFFFFF} to leave the Nade Parkour!");
- Msg(playerid, -1, str);
- }
- else return Msg(playerid, -1, "You are already in the Nade Parkour!");
- FirstLevel(playerid);
- return 1;
- }
- CMD:exitnade(playerid, params[])
- {
- if(isPark[playerid] == true)
- {
- KillTimer(timers[playerid]);
- contador[1][playerid] = 0;
- contador[0][playerid] = 0;
- pFirstL[playerid] = 0;
- TextDrawHideForPlayer(playerid, tempo[playerid]);
- SetPlayerHealth(playerid, 0);
- isPark[playerid] = false;
- nivelPark[playerid] = 1;
- tentsPark[playerid] = 0;
- format(str, sizeof(str), "{00FF00}%s{FFFFFF} left the Nade Parkour ({00FF00}/nade{FFFFFF})", GetPlayerN(playerid));
- MsgAll(-1, str);
- }
- return 1;
- }
- CMD:try(playerid, params[])
- {
- if(isPark[playerid] == true)
- {
- new lvl = nivelPark[playerid];
- new tmps[64];
- format(tmps, sizeof(tmps), "parkour/%d.txt", lvl);
- new Float:pos[7];
- pos[0] = dini_Float(tmps, "posIX");
- pos[1] = dini_Float(tmps, "posIY");
- pos[2] = dini_Float(tmps, "posIZ");
- pos[3] = dini_Float(tmps, "angI");
- pos[4] = dini_Float(tmps, "posFX");
- pos[5] = dini_Float(tmps, "posFY");
- pos[6] = dini_Float(tmps, "posFZ");
- SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
- SetPlayerFacingAngle(playerid, pos[3]);
- SetPlayerCheckpoint(playerid, pos[4], pos[5], pos[6], 1.5);
- DarNadesVida(playerid);
- tentsPark[playerid]++;
- }
- return 1;
- }
- // * FUNCS * //
- forward TimeCount(playerid);
- public TimeCount(playerid)
- {
- contador[1][playerid]++;
- if (contador[1][playerid] == 60)
- {
- contador[1][playerid] = 0;
- contador[0][playerid]++;
- }
- new string[36];
- format(string, sizeof(string), "~y~~w~%d~r~m~w~ :%d~r~s", contador[0][playerid], contador[1][playerid]);
- if(pFirstL[playerid] == 1)
- {
- pFirstL[playerid] = 0;
- TextDrawSetString(tempo[playerid], string);
- TextDrawShowForPlayer(playerid, tempo[playerid]);
- }
- else return TextDrawSetString(tempo[playerid], string);
- return 1;
- }
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Nade Parkouring v1.2 by Badjouras");
- print("--------------------------------------\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- pFirstL[playerid] = 1;
- isPark[playerid] = false;
- nivelPark[playerid] = 1;
- tentsPark[playerid] = 0;
- contador[0][playerid] = 0;
- contador[1][playerid] = 0;
- tempo[playerid] = TextDrawCreate(490 ,396 , "123");
- TextDrawFont(tempo[playerid] , 1);
- TextDrawLetterSize(tempo[playerid] , 0.6, 2);
- TextDrawColor(tempo[playerid] , 0x000000FF);
- TextDrawSetOutline(tempo[playerid] , false);
- TextDrawSetProportional(tempo[playerid] , false);
- TextDrawHideForPlayer(playerid, tempo[playerid]);
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- pFirstL[playerid] = 1;
- isPark[playerid] = false;
- nivelPark[playerid] = 1;
- tentsPark[playerid] = 0;
- contador[0][playerid] = 0;
- contador[1][playerid] = 0;
- KillTimer(timers[playerid]);
- TextDrawDestroy(tempo[playerid]);
- return 1;
- }
- public OnPlayerEnterCheckpoint(playerid)
- {
- if(isPark[playerid] == false) return 1;
- DisablePlayerCheckpoint(playerid);
- PlayerPlaySound(playerid, 17802, 0, 0, 0);
- nivelPark[playerid]++;
- NextLevel(playerid);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment