25.06.2011, 03:38
pawn Код:
#include <a_samp>
#include <dini>
#include <dudb>
#pragma tabsize 0
#pragma unused ret_memcpy
#define COLOR_YELLOW 0xD8D8D8FF
#define COLOR_FADE1 0xE6E6E6E6
#define COLOR_FADE2 0xC8C8C8C8
#define COLOR_FADE3 0xAAAAAAAA
#define COLOR_FADE4 0x8C8C8C8C
#define COLOR_FADE5 0x6E6E6E6E
#define COLOR_SYSTEM 0xEFEFF7AA
#define COLOR_CYAN 0x00FFFFAA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_RED 0xFF0000FF
new IsLogged[MAX_PLAYERS];
new file[256];
new logged[MAX_PLAYERS];
main()
{
}
enum pInfo
{
AdminLevel,
Cash,
Score,
CV,
TCP,
ADA,
PCC,
Warns,
}
new PlayerInfo[MAX_PLAYERS][pInfo];
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" RAdmin System by Ricardo_Rodrigues");
print("--------------------------------------\n");
return 1;
}
//--------------------------------------Login/Register System--------------------------------------------------------
public OnPlayerConnect(playerid)
{
IsLogged[playerid] = 0;
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), "Contas/%s.ini", name);
if (!dini_Exists(file))
{
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Hi your not registered", "Welcome, your not registered mate, put your registration password below.", "Register", "Leave");
}
if(fexist(file))
{
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Hi your registered", "You are registred, put your password below.", "Login", "Leave");
}
if(PlayerInfo[playerid][Warns] == 5)
{
SendClientMessage(playerid, 0xFF00CC, "Your account is blocked for max. warns(5) reached, apply on forums to unblock your account.");
Kick(playerid);
}
}
public OnPlayerDisconnect(playerid, reason)
{
new name[24];
GetPlayerName(playerid,name,24);
format(file,sizeof(file),"Contas/%s.ini",name);
if(dini_Exists(file))
{
dini_IntSet(file,"Cash",GetPlayerMoney(playerid));
dini_IntSet(file,"Score",GetPlayerScore(playerid));
dini_IntSet(file,"AdminLevel",PlayerInfo[playerid][AdminLevel]);
dini_IntSet(file,"CVLevel",PlayerInfo[playerid][CV]);
dini_IntSet(file,"ADALevel",PlayerInfo[playerid][ADA]);
dini_IntSet(file,"TCPLevel",PlayerInfo[playerid][TCP]);
dini_IntSet(file,"PCCLevel",PlayerInfo[playerid][PCC]);
dini_IntSet(file,"Warns",PlayerInfo[playerid][Warns]);
IsLogged[playerid] = 0;
return 1;
}
return 1;
}
public OnPlayerText(playerid, text[])
{
return 1;
}
//-------------------------------Commands----------------------------------------------------
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/lchat", true) == 0)
{
if(IsLogged[playerid] == 1)
{
if(PlayerInfo[playerid][AdminLevel] >= 1)
{
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
SendClientMessageToAll(COLOR_SYSTEM, " ");
GameTextForAll("Limpei o Chat !!", 1000,1);
new PlayerName[30];
GetPlayerName(playerid, PlayerName, 30);
printf("[Command] %s usou /clearchat", PlayerName);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_CYAN, "Vocк nгo й um Admin para usar este comando !");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_CYAN, "Vocк tem que estar logado para usar este comando!");
}
}
if(!strcmp(cmdtext, "/tcps", true))
{
SendClientMessage(playerid, COLOR_RED, "[ MEMBRO DO TCP ONLINE ]");
new count=0;
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(logged[i] == 1)
{
if(PlayerInfo[i][TCP] >= 1)
{
new cargo[20];
if(PlayerInfo[i][TCP] == 1) cargo = "Fogueteiro";
if(PlayerInfo[i][TCP] == 2) cargo = "Vapor";
if(PlayerInfo[i][TCP] == 3) cargo = "Traficante";
if(PlayerInfo[i][TCP] == 4) cargo = "Gerente";
if(PlayerInfo[i][TCP] == 5) cargo = "Dono do Morro";
new str[256];
new pname[24];
GetPlayerName(i, pname, 24);
format(str, 256, "%s - %s",cargo, pname );
SendClientMessage(playerid, COLOR_CYAN, str);
count++;
}
}
}
}
if(count == 0)
{
SendClientMessage(playerid, COLOR_CYAN, "Nгo tem nenhum TCP on-line agora!");
}
return 1;
}
return 0;
}
public OnPlayerSpawn(playerid)
{
if(PlayerInfo[playerid][CV] >= 1)
{
// CV
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,-2660.4978,881.9752,79.7738);
GameTextForPlayer(playerid,"~r~COMPLEXO DO ALMEAO", 1000,1);
GivePlayerWeapon(playerid,29,999999);
GivePlayerWeapon(playerid,27,999999);
GivePlayerWeapon(playerid,41,999999);
GivePlayerWeapon(playerid,24,999999);
GivePlayerWeapon(playerid,4,999999);
GivePlayerWeapon(playerid,34,999999);
GivePlayerWeapon(playerid,30,999999);
SetPlayerArmour(playerid, 100.0);
SetPlayerColor(playerid, 0xFF0000FF);
SetPlayerSkin(playerid, 107);
SetPlayerHealth(playerid, 100.0);
SetPlayerVirtualWorld(playerid, 0);
TogglePlayerControllable(playerid,1);
SendClientMessage(playerid, COLOR_WHITE, "Use /comandoscv, para ver os comandos de sua Facзгo !");
SendClientMessage(playerid, COLOR_RED, "Quem comanda й o comando, e o comando e VERMELHO !");
TogglePlayerControllable(playerid,1);
}
if(PlayerInfo[playerid][ADA] >= 1)
{
// ADA
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,-2548.8665,-465.9125,69.1830);
GameTextForPlayer(playerid,"~y~ROCINHA", 1000,1);
GivePlayerWeapon(playerid,29,999999);
GivePlayerWeapon(playerid,27,999999);
GivePlayerWeapon(playerid,41,999999);
GivePlayerWeapon(playerid,24,999999);
GivePlayerWeapon(playerid,4,999999);
GivePlayerWeapon(playerid,34,999999);
GivePlayerWeapon(playerid,30,999999);
SetPlayerArmour(playerid, 100.0);
SetPlayerColor(playerid, COLOR_YELLOW);
SetPlayerSkin(playerid, 14);
SetPlayerHealth(playerid, 100.0);
SetPlayerVirtualWorld(playerid, 0);
TogglePlayerControllable(playerid,1);
SendClientMessage(playerid, COLOR_WHITE, "Use /comandosada, para ver os comandos de sua Facзгo !");
SendClientMessage(playerid, COLOR_YELLOW, "Somos Amigos dos Amigos, sem cumpri vacilaзгo !");
TogglePlayerControllable(playerid,1);
}
if(PlayerInfo[playerid][TCP] >= 1)
{
// TCP
SendClientMessage(playerid, COLOR_WHITE, "Use /comandostcp, para ver os comandos de sua Facзгo !");
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,-2452.8435,1188.5889,35.1641);
GameTextForPlayer(playerid,"~b~ACARI", 1000,1);
GivePlayerWeapon(playerid,29,999999);
GivePlayerWeapon(playerid,27,999999);
GivePlayerWeapon(playerid,41,999999);
GivePlayerWeapon(playerid,24,999999);
GivePlayerWeapon(playerid,4,999999);
GivePlayerWeapon(playerid,34,999999);
GivePlayerWeapon(playerid,30,999999);
SetPlayerArmour(playerid, 100.0);
SetPlayerColor(playerid, 0x0078F6AA);
SetPlayerSkin(playerid, 29);
SetPlayerHealth(playerid, 100.0);
SetPlayerVirtualWorld(playerid, 0);
TogglePlayerControllable(playerid,1);
SendClientMessage(playerid, 0x0078F6AA, "Terceiro Comando Puro, fala que й nуis !");
TogglePlayerControllable(playerid,1);
}
if(PlayerInfo[playerid][PCC] >= 1)
{
// PCC
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,-2315.3228,109.8254,35.3125);
GameTextForPlayer(playerid,"~r~COMPLEXO DO ALMEAO", 1000,1);
GivePlayerWeapon(playerid,29,999999);
GivePlayerWeapon(playerid,27,999999);
GivePlayerWeapon(playerid,41,999999);
GivePlayerWeapon(playerid,24,999999);
GivePlayerWeapon(playerid,4,999999);
GivePlayerWeapon(playerid,34,999999);
GivePlayerWeapon(playerid,30,999999);
SetPlayerArmour(playerid, 100.0);
SetPlayerColor(playerid, 0xA81B00AA);
SetPlayerSkin(playerid, 200);
SetPlayerHealth(playerid, 100.0);
SetPlayerVirtualWorld(playerid, 0);
TogglePlayerControllable(playerid,1);
SendClientMessage(playerid, COLOR_WHITE, "Use /comandospcc, para ver os comandos de sua Facзгo !");
SendClientMessage(playerid, 0xA81B00AA, "Quem manda ? Quem manda ? Quem manda, й o PCC !");
TogglePlayerControllable(playerid,1);
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if (dialogid == 1)
{
new name[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), "Contas/%s.ini", name);
if(!response) return Kick(playerid);
if(!strlen(inputtext)) return
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Hi your not registered", "Welcome, your not registered mate, input your registration pw below", "Register", "Leave");
dini_Create(file);
dini_IntSet(file, "Password", udb_hash(inputtext));
dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][AdminLevel] = 0);
dini_IntSet(file, "Cash",PlayerInfo[playerid][Cash] = 500);
dini_IntSet(file, "Score",PlayerInfo[playerid][Score] = 0);
dini_IntSet(file, "CVLevel",PlayerInfo[playerid][CV] = 0);
dini_IntSet(file, "Warns",PlayerInfo[playerid][Warns] = 0);
format(string, 128, "[SYSTEM]: You succesfully registered the nickname %s with password %s, you have been auto logged in.", name, inputtext);
SendClientMessage(playerid, 0xFF00CC, string);
IsLogged[playerid] = 1;
}
if (dialogid == 2)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(file, sizeof(file), "Contas/%s.ini", name);
if(!response) return Kick(playerid);
if (!strlen(inputtext)) return ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Hi your registered", "You are registred, please login.", "Login", "Leave");
new tmp;
tmp = dini_Int(file, "Password");
if(udb_hash(inputtext) != tmp) {
SendClientMessage(playerid, 0xFF00CC, "Wrong PW sir.");
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Hi your registered", "You are registred, put the password below.", "Login", "Leave");
}
else
{
IsLogged[playerid] = 1;
SetPlayerMoney(playerid, dini_Int(file, "Cash"));
SetPlayerScore(playerid, dini_Int(file, "Score"));
SetPlayerColor(playerid, dini_Int(file, "Color"));
PlayerInfo[playerid][Warns] = dini_Int(file, "Warns");
PlayerInfo[playerid][CV] = dini_Int(file, "CVLevel");
PlayerInfo[playerid][ADA] = dini_Int(file, "ADALevel");
PlayerInfo[playerid][TCP] = dini_Int(file, "TCPLevel");
PlayerInfo[playerid][PCC] = dini_Int(file, "PCCLevel");
PlayerInfo[playerid][AdminLevel] = dini_Int(file, "AdminLevel");
SendClientMessage(playerid,0xFF00CC, "[SYSTEM]: Logado com Sucesso !!");
}
}
return 1;
}
return 0;
}