17.12.2011, 16:40
hey all i need help to convert this code to luxadmin
LuxAdmin use's
#include <ldudb>
#include <lfuncs>
i get help i will +rep
LuxAdmin use's
#include <ldudb>
#include <lfuncs>
i get help i will +rep
Код:
#include <a_samp> #include <dini> #include <sscanf2> #define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1 #define Green 0x16EB43FF enum PData { EXP, Level }; new PlayerInfo[MAX_PLAYERS][PData]; new file2[256]; forward Payday(playerid); public OnFilterScriptInit() { print("\n=========================================="); print(" Exp and Level System by Xaviour212 Loaded"); print("==========================================\n"); for(new j = 0; j < MAX_PLAYERS; j++) { SetTimerEx("Payday",1*60*60*1000,true,"i",j); } return 1; } public OnFilterScriptExit() { return 1; } public OnPlayerConnect(playerid) { if(!dini_Exists(PFile(playerid))) { dini_Create(PFile(playerid)); SetPlayerScore(playerid, GetPlayerLevel(playerid)); GivePlayerLevel(playerid, 1); } else { SetPlayerScore(playerid, GetPlayerLevel(playerid)); PlayerInfo[playerid][EXP] = GetPlayerExp(playerid); PlayerInfo[playerid][Level] = GetPlayerLevel(playerid); } return 0; } public OnPlayerDeath(playerid, killerid, reason) { new string[256]; new Xp = 5*GetPlayerLevel(killerid); GivePlayerExp(killerid, 200-Xp); format(string, sizeof(string), "You has killed {FF0000}%s {16EB43}and get a {FFFFFF}%d {16EB43}exp", Gn(playerid), 200-Xp); SendClientMessage(killerid, Green, string); return 1; } public Payday(playerid) { new Bonus = 500*GetPlayerLevel(playerid); new string[50]; GivePlayerMoney(playerid, 2500+Bonus); format(string, sizeof(string), "~w~PayDay! ~n~~g~$%d", 2500+Bonus); GameTextForPlayer(playerid, string, 3000, 1); } public OnPlayerUpdate(playerid) { new string[256]; SetPlayerScore(playerid, GetPlayerLevel(playerid)); if(GetPlayerExp(playerid) >= 1000) { if(GetPlayerLevel(playerid) <= 40) { GivePlayerLevel(playerid, 1); format(string, sizeof(string), "Congratulations! Your level has been increased to {FFFFFF}%d", GetPlayerLevel(playerid)); SendClientMessage(playerid, Green, string); GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~w~Updating Score List...",3000,3); GivePlayerExp(playerid, - 1000); } else if(GetPlayerLevel(playerid) >= 40) { SetPlayerExp(playerid, 1000); SetPlayerLevel(playerid, 40); } } if(GetPlayerLevel(playerid) >= 40) { format(string, sizeof(string), "You have reached the maximum level", GetPlayerLevel(playerid)); SendClientMessage(playerid, Green, string); } return 1; } SetPlayerExp(playerid, exp) { dini_IntSet(PFile(playerid), "Exp", exp); PlayerInfo[playerid][EXP] = exp; } GivePlayerExp(playerid, exp) { PlayerInfo[playerid][EXP] += exp; dini_IntSet(PFile(playerid), "Exp", PlayerInfo[playerid][EXP]); } SetPlayerLevel(playerid, level) { PlayerInfo[playerid][Level] = level; dini_IntSet(PFile(playerid), "Level", PlayerInfo[playerid][Level]); } GivePlayerLevel(playerid, level) { PlayerInfo[playerid][Level] += level; dini_IntSet(PFile(playerid), "Level", PlayerInfo[playerid][Level]); } stock GetPlayerExp(playerid) return dini_Int(PFile(playerid), "Exp"); stock GetPlayerLevel(playerid) return dini_Int(PFile(playerid), "Level"); stock Gn(playerid) { new pname[24]; GetPlayerName(playerid,pname,MAX_PLAYER_NAME); return pname; } stock PFile(playerid) { format(file2,64,"Users/%s.ini",Gn(playerid)); return file2; } //================EXAMPLE COMMAND public OnPlayerCommandText(playerid, cmdtext[]) { dcmd(setexp, 6, cmdtext); dcmd(giveexp, 7, cmdtext); dcmd(getexp, 6, cmdtext); dcmd(givelevel, 9, cmdtext); dcmd(getlevel, 8, cmdtext); dcmd(paydayall, 9, cmdtext); dcmd(getstatus, 9, cmdtext); return 0; } dcmd_setexp(playerid, params[])// Set player exp { new giveplayerid, amount; if(!sscanf(params, "dd", giveplayerid, amount)) return SendClientMessage(playerid, 0xFF0000AA, "{FF0000}[ERROR]{FFFFFF}Usage: /setexp [PlayerID] [Exp]"); SetPlayerExp(playerid, amount); return 1; } dcmd_giveexp(playerid, params[])// Give player level { new giveplayerid, amount; if(!sscanf(params, "dd", giveplayerid, amount)) return SendClientMessage(playerid, 0xFF0000AA, "{FF0000}[ERROR]{FFFFFF}Usage: /giveexp [PlayerID] [Exp]"); GivePlayerExp(giveplayerid, amount); return 1; } dcmd_getexp(playerid, params[])//Get a player exp { new giveplayerid, string[256]; if(!sscanf(params, "d", giveplayerid)) return SendClientMessage(playerid, 0xFF0000AA, "{FF0000}[ERROR]{FFFFFF}Usage: /getexp [PlayerID]"); format(string, sizeof(string), "{FF0000}%s{FFFFFF} having {A1CAF1}%d{FFFFFF} exp", Gn(giveplayerid), GetPlayerExp(giveplayerid)); SendClientMessage(playerid, Green, string); return 1; } dcmd_givelevel(playerid, params[])//Give player level { new giveplayerid, amount; if(!sscanf(params, "dd", giveplayerid, amount)) return SendClientMessage(playerid, 0xFF0000AA, "{FF0000}[ERROR]{FFFFFF}Usage: /givelevel [PlayerID] [Level]"); GivePlayerLevel(giveplayerid, amount); return 1; } dcmd_getlevel(playerid, params[])//Get player level { new giveplayerid, string[256]; if(!sscanf(params, "d", giveplayerid)) return SendClientMessage(playerid, 0xFF0000AA, "{FF0000}[ERROR]{FFFFFF}Usage: /getlevel [PlayerID]"); format(string, sizeof(string), "{FF0000}%s{FFFFFF} is a level{A1CAF1}%d{FFFFFF}.", Gn(giveplayerid), GetPlayerLevel(giveplayerid)); SendClientMessage(playerid, Green, string); return 1; } dcmd_paydayall(playerid, params[])//Payday for all player { #pragma unused params #pragma unused playerid for(new j = 0; j < MAX_PLAYERS; j++) { Payday(j); } return 1; } dcmd_getstatus(playerid, params[])//Get player status { new giveplayerid, string[256]; new Bonus = 500*GetPlayerLevel(giveplayerid); if(!sscanf(params, "d", giveplayerid)) return SendClientMessage(playerid, 0xFF0000AA, "{FF0000}[ERROR]{FFFFFF}Usage: /getstatus [PlayerID]"); format(string, sizeof(string), "{446CCF}Name{FFFFFF}: %s \n{FF0000}Exp{FFFFFF}: %d \n{A1CAF1}Level{FFFFFF}: %d \n{00FF00}Payday{FFFFFF}: %d", Gn(giveplayerid), GetPlayerExp(giveplayerid), GetPlayerLevel(playerid), 2500+Bonus); SendClientMessage(playerid, Green, string); return 1; }