15.11.2011, 00:04
Tou Com Problema para dar Helper com FS que eu baxei e Arumei os Bug mais nao Consigo dar Helper ?? Alguem Pode mim ajuda ??
#include <a_samp> #include <utils> #define COLOR_GRAD1 0xB4B5B7FF #define COLOR_GRAD2 0xBFC0C2FF #define COLOR_GREY 0xAFAFAFAA #define COLOR_ORANGE 0xFF9900AA #define COLOR_WHITE 0xFFFFFFAA #define COLOR_HELPER 0x00D087AA forward SendHelperMessage(color, string[]); forward SendHelperAdminMessage(color, string[]); new anhelper[MAX_PLAYERS]; new meavaliehelper[MAX_PLAYERS]; new meavalie[MAX_PLAYERS]; new clickplay[MAX_PLAYERS]; forward TempoAnHelper(playerid); forward TempoAvalieHelper(playerid); #define DIALOG_MEAVALIE 100 #define DIALOG_HELPER 101 #define DIALOG_PAR 102 #define TEMPO_AN 900000 // 15 minutos #define TEMPO_MEAVALIE 900000 //15 minutos enum pInfo { pAdmin, pHelper, pHelperTrab }; new PlayerInfo[MAX_PLAYERS][pInfo]; #if defined FILTERSCRIPT public OnFilterScriptInit() { print("\n--------------------"); print(" Sistema de Helpers "); print("--------------------\n"); return 1; } public OnFilterScriptExit() { return 1; } #else main() { print("\n--------------------"); print(" Sistema de Helpers "); print("--------------------\n"); } #endif public OnPlayerConnect(playerid) { PlayerInfo[playerid][pHelper] = 0; PlayerInfo[playerid][pHelperTrab] = 0; return 1; } public OnPlayerDisconnect(playerid, reason) { return PlayerInfo[playerid][pHelperTrab] = 0; } public OnPlayerCommandText(playerid, cmdtext[]) { new sendername[MAX_PLAYER_NAME]; GetPlayerName(playerid, sendername, sizeof(sendername)); new giveplayer[MAX_PLAYER_NAME]; new cmd[128]; new tmp[128]; //new giveplayerid, idx; new idx; new string[128]; cmd = strtok(cmdtext, idx); // adicione isso. if (strcmp(cmd, "/helpers", true) == 0) { SendClientMessage(playerid, COLOR_GREY, "||--||--|| Helpers Online ||--||--||"); for(new i = 0; i <= MAX_PLAYERS; i++) { if(IsPlayerConnected(i) == 1 && PlayerInfo[i][pHelper] > 0) { if(PlayerInfo[i][pHelperTrab] == 1) { GetPlayerName(i, sendername, sizeof(sendername)); if(PlayerInfo[i][pHelper] == 1) { format(string, 256, "Nome: %s [Helper Inicante] (Trabalhando)", sendername); SendClientMessage(playerid, COLOR_HELPER, string); } if(PlayerInfo[i][pHelper] >= 2 && PlayerInfo[i][pAdmin] < 10) { format(string, 256, "Nome: %s [Helper] (Trabalhando)", sendername); SendClientMessage(playerid, COLOR_HELPER, string); } if(PlayerInfo[i][pHelper] >= 10 && PlayerInfo[i][pAdmin] < 30) { format(string, 256, "Nome: %s [Helper Master] (Trabalhando)", sendername); SendClientMessage(playerid, COLOR_HELPER, string); } if(PlayerInfo[i][pHelper] >= 30) { format(string, 256, "Nome: %s [Helper Lider] (Trabalhando)", sendername); SendClientMessage(playerid, COLOR_HELPER, string); } } else { GetPlayerName(i, sendername, sizeof(sendername)); if(PlayerInfo[i][pHelper] == 1) { format(string, 256, "Nome: %s [Helper Inicante] (Jogando)", sendername); SendClientMessage(playerid, COLOR_HELPER, string); } if(PlayerInfo[i][pHelper] >= 2 && PlayerInfo[i][pAdmin] < 10) { format(string, 256, "Nome: %s [Helper] (Jogando)", sendername); SendClientMessage(playerid, COLOR_HELPER, string); } if(PlayerInfo[i][pHelper] >= 10 && PlayerInfo[i][pAdmin] < 30) { format(string, 256, "Nome: %s [Helper Master] (Jogando)", sendername); SendClientMessage(playerid, COLOR_HELPER, string); } if(PlayerInfo[i][pHelper] >= 30) { format(string, 256, "Nome: %s [Helper Lider] (Jogando)", sendername); SendClientMessage(playerid, COLOR_HELPER, string); } } } } return 1; } if(strcmp(cmd, "/avisohelper", true) == 0 || strcmp(cmd, "/avh", true) == 0) { if(IsPlayerConnected(playerid)) { new length = strlen(cmdtext); while ((idx < length) && (cmdtext[idx] <= ' ')) { idx++; } new offset = idx; new result[128]; while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = cmdtext[idx]; idx++; } result[idx - offset] = EOS; if(!strlen(result)) { SendClientMessage(playerid, COLOR_GRAD2, "USE: (/[av]iso[h]elper) [mensagem]"); return 1; } if(PlayerInfo[playerid][pHelperTrab] == 0) { return SendClientMessage(playerid,COLOR_GRAD2,"Vocк nгo estб em trabalho!Use: /ha"); } if(PlayerInfo[playerid][pHelper] < 2) { return SendClientMessage(playerid,COLOR_GRAD1,"Vocк nгo tem autorizaзгo para usar este comando"); } if(anhelper[playerid] == 1) { return SendClientMessage(playerid,COLOR_GRAD1,"Vocк ainda nгo pode fazer um novo anuncio!Espere..."); } SendClientMessageToAll(COLOR_WHITE,"||-||Aviso dos Helpers||-||"); if(PlayerInfo[playerid][pHelper] >= 3) { format(string, sizeof(string), "[HELPER]: Helper %s: %s", sendername, result); } else if(PlayerInfo[playerid][pHelper] >= 10) { format(string, sizeof(string), "[HELPER]: Helper Master %s: %s", sendername, result); } else if(PlayerInfo[playerid][pHelper] >= 30) { format(string, sizeof(string), "[HELPER]: Helper Lider %s: %s", sendername, result); } SendClientMessageToAll(COLOR_HELPER, string); anhelper[playerid] = 1; SetTimer("TempoAnHelper",TEMPO_AN,false); } return 1; } if(strcmp(cmd, "/ahelperchat", true) == 0 || strcmp(cmd, "/ahc", true) == 0) { if(IsPlayerConnected(playerid)) { GetPlayerName(playerid, sendername, sizeof(sendername)); new length = strlen(cmdtext); while ((idx < length) && (cmdtext[idx] <= ' ')) { idx++; } new offset = idx; new result[126]; while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = cmdtext[idx]; idx++; } result[idx - offset] = EOS; if(!strlen(result)) { SendClientMessage(playerid, COLOR_GRAD2, "USE: (/ahc) [Chat dos helpers e admins]"); return 1; } if (PlayerInfo[playerid][pHelper] >= 1) { format(string, sizeof(string), "Helper %s[%d]: %s", sendername, PlayerInfo[playerid][pHelper], result); SendHelperAdminMessage(COLOR_HELPER, string); } else if (PlayerInfo[playerid][pAdmin] >= 1 || IsPlayerAdmin(playerid)) { format(string, sizeof(string), "Helper %s[%d]: %s", sendername, PlayerInfo[playerid][pHelper], result); SendHelperAdminMessage(COLOR_HELPER, string); } else { SendClientMessage(playerid, COLOR_GRAD1, "** vocк nгo estб autorizado a usar esse comando!"); } } return 1; } if(strcmp(cmd, "/helperchat", true) == 0 || strcmp(cmd, "/hc", true) == 0) { if(IsPlayerConnected(playerid)) { GetPlayerName(playerid, sendername, sizeof(sendername)); new length = strlen(cmdtext); while ((idx < length) && (cmdtext[idx] <= ' ')) { idx++; } new offset = idx; new result[126]; while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = cmdtext[idx]; idx++; } result[idx - offset] = EOS; if(!strlen(result)) { SendClientMessage(playerid, COLOR_GRAD2, "USE: (/hc) [Chat dos helpers]"); return 1; } format(string, sizeof(string), "Helper %s[%d]: %s", sendername, PlayerInfo[playerid][pHelper], result); if (PlayerInfo[playerid][pHelper] >= 1) { SendHelperMessage(COLOR_HELPER, string); } else { SendClientMessage(playerid, COLOR_GRAD1, "** vocк nгo estб autorizado a usar esse comando!"); } } return 1; } if(strcmp(cmd,"/duvida",true) == 0 || strcmp(cmd,"/duv",true) == 0) { if(IsPlayerConnected(playerid)) { new length = strlen(cmdtext); while ((idx < length) && (cmdtext[idx] <= ' ')) { idx++; } new offset = idx; new result[64]; while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = cmdtext[idx]; idx++; } result[idx - offset] = EOS; if(!strlen(result)) { SendClientMessage(playerid, COLOR_GRAD2, "Use: /duvida [Pergunta]"); return 1; } format(string, sizeof(string), "Dъvida de %s(ID:%d): %s", sendername, playerid, (result)); SendHelperMessage(COLOR_HELPER, string); SendClientMessage(playerid, COLOR_GRAD2, "Sua dъvida foi enviada aos Helpers."); } return 1; } if(strcmp(cmd, "/helpajudar", true) == 0 || strcmp(cmd, "/ha", true) == 0) { if(IsPlayerConnected(playerid)) { if(PlayerInfo[playerid][pHelper] >= 1) { if(PlayerInfo[playerid][pHelperTrab] == 0) { SendClientMessageToAll(COLOR_WHITE,"||-||Aviso dos Helpers||-||"); format(string, 256, "Helper %s [%d] estб em trabalho, use /helpers para mais informaзхes.",sendername, playerid); SendClientMessageToAll(COLOR_HELPER, string); PlayerInfo[playerid][pHelperTrab] = 1; } else if(PlayerInfo[playerid][pHelperTrab] == 1) { SendClientMessageToAll(COLOR_WHITE,"||-||Aviso dos Helpers||-||"); format(string, 256, "Helper %s [%d] estб em jogo, use /helpers para mais informaзхes.",sendername, playerid); SendClientMessageToAll(COLOR_HELPER, string); PlayerInfo[playerid][pHelperTrab] = 0; } } else { SendClientMessage(playerid, COLOR_GRAD1, "** vocк nгo estб autorizado a usar esse comando!"); } } return 1; } if(strcmp(cmd, "/meavalie", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "USE: /meavalie [ID/Nome]"); return 1; } new giveplayerid; giveplayerid = ReturnUser(tmp); GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer)); if(IsPlayerConnected(giveplayerid)) { if(giveplayerid != INVALID_PLAYER_ID) { if(PlayerInfo[playerid][pHelper] >= 1) { if(PlayerInfo[playerid][pHelperTrab] == 0) { return SendClientMessage(playerid,COLOR_GRAD2,"Vocк nгo estб em trabalho!Use: /ha"); } if(meavaliehelper[playerid] == 1) { return SendClientMessage(playerid,COLOR_GRAD1,"Vocк jб foi avaliado recentemente!Espere..."); } meavalie[giveplayerid] = playerid; meavaliehelper[playerid] = 1; SetTimer("TempoAvalieHelper",TEMPO_MEAVALIE,false) ; format(string,sizeof(string),"Olб %s\nO Helper %s[ID:%d]\nPediu a vocк que o avalia-se como helper\nCaso ele tenha o ajudado aperte em SIM\nCaso contrario aperte NГO",giveplayer, sendername, playerid); ShowPlayerDialog(playerid, DIALOG_MEAVALIE, DIALOG_STYLE_MSGBOX, "Avaliaзгo do Helper", string, "Sim", "Nгo"); } else { SendClientMessage(playerid, COLOR_GRAD1, "** vocк nгo estб autorizado a usar esse comando!"); } } } else { format(string, sizeof(string), "O jogador nгo estб conectado!", giveplayerid); SendClientMessage(playerid, COLOR_GRAD1, string); } } return 1; } if(strcmp(cmd, "/irh", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "USE: /irh [ID/Nome]"); return 1; } new giveplayerid; giveplayerid = ReturnUser(tmp); new Float:givepx,Float:givepy,Float:givepz,Float:givep ang; GetPlayerPos(giveplayerid, givepx, givepy, givepz); GetPlayerFacingAngle(giveplayerid,givepang); if(IsPlayerConnected(giveplayerid)) { if(giveplayerid != INVALID_PLAYER_ID) { if(PlayerInfo[playerid][pHelper] >= 10) { if(PlayerInfo[playerid][pHelperTrab] == 0) { return SendClientMessage(playerid,COLOR_GRAD2,"Vocк nгo estб em trabalho!Use: /ha"); } SetPlayerInterior(playerid,GetPlayerInterior(givep layerid)); SetPlayerVirtualWorld(playerid,GetPlayerVirtualWor ld(giveplayerid)); SetPlayerPos(playerid,givepx,givepy+2, givepz); SetPlayerFacingAngle(playerid,givepang); } else { SendClientMessage(playerid, COLOR_GRAD1, "** vocк nгo estб autorizado a usar esse comando!"); } } } else { format(string, sizeof(string), "O jogador nгo estб conectado!", giveplayerid); SendClientMessage(playerid, COLOR_GRAD1, string); } } return 1; } if(strcmp(cmd, "/darhelper", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "USE: /darhelper [playerid/ParteDoNome] [level(0-100)]"); return 1; } new playa; new level; playa = ReturnUser(tmp); tmp = strtok(cmdtext, idx); level = strval(tmp); if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdmin] >= 1337) { if(IsPlayerConnected(playa)) { if(playa != INVALID_PLAYER_ID) { if(level < 0 || level > 30) { SendClientMessage(playerid, COLOR_GREY, "** Nнvel nгo pode ser inferior a 0 ou acima de 100!"); return 1; } GetPlayerName(playa, giveplayer, sizeof(giveplayer)); PlayerInfo[playa][pHelper] = level; format(string, sizeof(string), "** Vocк definiu o nivel de helper de %s[ID:%d] para [%d]",giveplayer,playa,level); SendClientMessage(playerid, COLOR_ORANGE, string); format(string, sizeof(string), "** Admin %s[ID:%d] definiu seu nivel de helper para [%d]",sendername,playerid,level); SendClientMessage(playa, COLOR_ORANGE, string); format(string, sizeof(string), "[HELPER]%s[ID %d] й o novo helper do servidor",giveplayer,playa); SendHelperMessage(COLOR_HELPER,string); format(string, sizeof(string), "~b~Parabens %s voce agora e um Helper",giveplayer); GameTextForPlayer(playa, string, 4500,3); } } } else { SendClientMessage(playerid, COLOR_GRAD1, "** vocк nгo estб autorizado a usar esse comando!"); } } return 1; } return 0; } public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { new string[128]; new giveplayer[MAX_PLAYER_NAME]; GetPlayerName(meavalie[playerid], giveplayer, sizeof(giveplayer)); new sendername[MAX_PLAYER_NAME]; GetPlayerName(playerid, sendername, sizeof(sendername)); if(dialogid == DIALOG_MEAVALIE) { if(response == 1) { SendClientMessage(meavalie[playerid],COLOR_GRAD2,"O Jogador qualificou a sua ajuda como {9EC73D}POSITIVA"); PlayerInfo[meavalie[playerid]][pHelper] = PlayerInfo[meavalie[playerid]][pHelper]+1; format(string, sizeof(string), "Vocк classificou a ajuda do Helper %s como {9EC73D}positiva!",giveplayer); SendClientMessage(playerid,COLOR_HELPER,string); } if(response == 0) { SendClientMessage(meavalie[playerid],COLOR_GRAD2,"O Jogador qualificou a sua ajuda como {FF0000}NEGATIVA"); format(string, sizeof(string), "Vocк classificou a ajuda do Helper %s como {FF0000}negativa!",giveplayer); SendClientMessage(playerid,COLOR_HELPER,string); } return 1; } if(dialogid == DIALOG_PAR) { if(response) { format(string, sizeof(string), "Helper %s[ID %d]: %s",sendername,playerid,strlen(inputtext)); SendClientMessage(clickplay[playerid], COLOR_GREY,string); } } if(dialogid == DIALOG_HELPER) { if(response) { if(listitem == 0) { format(string, sizeof(string), "/irh %d",clickplay[playerid]); OnPlayerCommandText(playerid,string); } else if(listitem == 1) { format(string, sizeof(string), "/meavalie %d",clickplay[playerid]); OnPlayerCommandText(playerid,string); } else if(listitem == 2) { ShowPlayerDialog(playerid, DIALOG_PAR,DIALOG_STYLE_INPUT,"Mensagem","Digite sua mensagem abaixo","Ok","Cancel"); } } } return 1; } public OnPlayerClickPlayer(playerid, clickedplayerid, source) { if(PlayerInfo[playerid][pHelper] >= 1) { clickplay[playerid] = clickedplayerid; ShowPlayerDialog(playerid,DIALOG_HELPER,DIALOG_STY LE_LIST,"Menu Helper","1\tIr\n2\tSolicitar Avaliaзгo\n3\tMensagem Particular","Selecionar","Cancelar"); } return 1; } strtok(const string[], &index) { new length = strlen(string); while ((index < length) && (string[index] <= ' ')) { index++; } new offset = index; new result[20]; while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1))) { result[index - offset] = string[index]; index++; } result[index - offset] = EOS; return result; } public SendHelperMessage(color, string[]) { for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { if(PlayerInfo[i][pHelper] >= 1 || IsPlayerAdmin(i)) { SendClientMessage(i, color, string); } } } printf("[Helper]%s", string); } public SendHelperAdminMessage(color, string[]) { for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { if(PlayerInfo[i][pHelper] >= 1 || IsPlayerAdmin(i) || PlayerInfo[i][pAdmin] >= 1) { SendClientMessage(i, color, string); } } } printf("[Helper]%s", string); } public TempoAnHelper(playerid) { anhelper[playerid] = 0; return 1; } public TempoAvalieHelper(playerid) { meavaliehelper[playerid] = 0; return 1; } |