27.02.2011, 13:46
Bom gente eu tentei mas nгo consegui, conhecem o mod insanity caps e o insanity glasses do Cynic? Queria passar o bonй amarelo e o уculos tipo de raio x sem borda de policial preto pro comando "/adm" para caso um administrador digite "/adm" e o trabalho[playerid] estiver em falso coloca-se um bonй nele e o уculos e quando o trabalhar[playerid] estivesse verdadeiro remove-se os objetos.
Meu gamemode:
Meu gamemode:
pawn Код:
#include <a_samp>
#include <dini>
#include <dudb>
#include <utils>
enum ipl
{
administrador,
sexo
}
new arquivo[2*100];
new civil[MAX_PLAYERS];
new nome[MAX_PLAYER_NAME];
new informacoes[MAX_PLAYERS][ipl];
new bool: logado[MAX_PLAYERS], bool: iniciante[MAX_PLAYERS], bool: checkpoint[MAX_PLAYERS], bool: trabalhar[MAX_PLAYERS];
new Float: x[MAX_PLAYERS], Float: y[MAX_PLAYERS], Float: z[MAX_PLAYERS], Float: angulo[MAX_PLAYERS];
forward mensagempraadm(COLOR, const string[]);
forward ProxDetector(Float:radi, playerid, str[], col1, col2, col3, col4, col5);
main()
{
print("\nServidor conectado\n");
}
public OnGameModeInit()
{
UsePlayerPedAnims();
SetGameModeText("Bsc");
AddPlayerClass(0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0);
AddStaticVehicle(462, 1562.51904297, -2338.48339844, 13.21709442, 90.00000000, -1, 1);
AddStaticVehicle(462, 1562.44750977, -2334.94116211, 13.21709442, 90.00000000, -1, -1);
AddStaticVehicle(462, 1562.40856934, -2331.87475586, 13.22153664, 90.00000000, -1, -1);
AddStaticVehicle(462, 1562.53649902, -2328.61914062, 13.22187996, 90.00000000, 6, 1);
AddStaticVehicle(462, 1562.54785156, -2325.38549805, 13.22191048, 90.00000000, 3, 1);
AddStaticVehicle(462, 1562.53295898, -2322.26831055, 13.22187042, 90.00000000, -1, -1);
AddStaticVehicle(462, 1562.58117676, -2318.79101562, 13.22200012, 90.00000000, -1, -1);
return 1;
}
public OnGameModeExit()
{
print("\nServidor desconectado\n");
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
return 1;
}
public OnPlayerConnect(playerid)
{
static
sNick[20],
iBurlo = 0,
sChars[28],
iLenChars,
iLenNick,
iUnder;
sChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ_", iBurlo = 0,
GetPlayerName(playerid, sNick, 22), iUnder = 0,
iLenNick = strlen(sNick),
iLenChars = strlen(sChars);
for(new i; i < iLenNick; i++)
{
for(new a; a < iLenChars; ++a)
{
if(sNick[i] != sChars[a] && sNick[i] != sChars[a] - 32)
++iBurlo;
}
if(sNick[i] == '_')
++iUnder;
}
if(iBurlo == ( iLenChars * iLenNick ) - iLenNick && iUnder == 1)
{
GetPlayerName(playerid, nome, sizeof nome);
format(arquivo, sizeof arquivo, "contas/%s.ini", nome);
if (!fexist(arquivo) )
{
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "{FFFFFF}Registro", "{FFFFFF}Bem vindo.\nPor favor digite uma senha:", "Registrar-me", "");
}
if (fexist(arquivo) )
{
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "{FFFFFF}Login", "{FFFFFF}Por favor digite sua senha:", "Logar-me", "");
}
}
else
{
ShowPlayerDialog(playerid, 6, DIALOG_STYLE_MSGBOX, "{FFFFFF}Aviso", "{FFFFFF}Neste servidor sу й permitido nome com letra maiъscula, com uma\nunderline no meio. Troque seu nome e volte novamente.", "Sair", "");
Kick(playerid);
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
GetPlayerName(playerid, nome, sizeof nome);
format(arquivo, sizeof arquivo, "contas/%s.ini", nome);
if (fexist(arquivo) )
{
GetPlayerPos(playerid, x[playerid], y[playerid], z[playerid]);
GetPlayerFacingAngle(playerid, angulo[playerid]);
dini_IntSet(arquivo, "Civil", civil[playerid]);
dini_IntSet(arquivo, "Dinheiro", GetPlayerMoney(playerid) );
dini_IntSet(arquivo, "Level", GetPlayerScore(playerid) );
dini_IntSet(arquivo, "Level procurado", GetPlayerWantedLevel(playerid) );
dini_IntSet(arquivo, "Level administrativo", informacoes[playerid][administrador]);
dini_FloatSet(arquivo, "X", x[playerid]);
dini_FloatSet(arquivo, "Y", y[playerid]);
dini_FloatSet(arquivo, "Z", z[playerid]);
dini_FloatSet(arquivo, "Вngulo", angulo[playerid]);
if (trabalhar[playerid] == false)
{
dini_IntSet(arquivo, "Pele", GetPlayerSkin(playerid) );
}
}
return 1;
}
public OnPlayerSpawn(playerid)
{
format(arquivo, sizeof arquivo, "contas/%s.ini", nome);
if (logado[playerid] == false)
{
Kick(playerid);
return 1;
}
if (civil[playerid] == 1)
{
SetPlayerColor(playerid, 0xFFFFFFFF);
}
if (iniciante[playerid] == true)
{
if (informacoes[playerid][sexo] == 1)
{
SetPlayerSkin(playerid, 60);
}
if (informacoes[playerid][sexo] == 2)
{
SetPlayerSkin(playerid, 56);
}
SetPlayerPos(playerid, 1612.4882, -2329.4709, 13.5469);
SetPlayerFacingAngle(playerid, 358.4933);
SendClientMessage(playerid, 0x33CCFFAA, "Caso tenha dъvidas digite o comando /ajuda.");
iniciante[playerid] = false;
return 1;
}
if (informacoes[playerid][administrador] == 1)
{
SetPlayerColor(playerid, 0xFDF837AA);
}
if (informacoes[playerid][administrador] == 2)
{
SetPlayerColor(playerid, 0xAFA938AA);
}
if (informacoes[playerid][administrador] == 3)
{
SetPlayerColor(playerid, 0x2EF1E8AA);
}
if (informacoes[playerid][administrador] == 4)
{
SetPlayerColor(playerid, 0xDCB643AA);
}
if (informacoes[playerid][administrador] == 5)
{
SetPlayerColor(playerid, 0x61AB3DAA);
}
x[playerid] = dini_Float(arquivo, "X");
y[playerid] = dini_Float(arquivo, "Y");
z[playerid] = dini_Float(arquivo, "Z");
angulo[playerid] = dini_Float(arquivo, "Вngulo");
SetPlayerPos(playerid, x[playerid], y[playerid], z[playerid]);
SetPlayerFacingAngle(playerid, angulo[playerid]);
SetPlayerSkin(playerid, dini_Int(arquivo, "Pele") );
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
return 1;
}
public OnVehicleSpawn(vehicleid)
{
return 1;
}
public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}
public OnPlayerText(playerid, text[])
{
new texto[500];
GetPlayerName(playerid, nome, sizeof nome);
format(texto, sizeof texto, "%s diz: %s", nome, text);
ProxDetector(13.0, playerid, texto, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF);
return 0;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
new idx, cmd[500], texto[500];
cmd = strtok(cmdtext, idx);
if (strcmp("/gps", cmdtext, true, 10) == 0)
{
ShowPlayerDialog(playerid, 4, DIALOG_STYLE_LIST, "{FFFFFF}Gps", "{FFFFFF}Lugares do governo", "Selecionar", "Cancelar");
return 1;
}
if (strcmp(cmd, "/daradmin", true) == 0)
{
GetPlayerName(playerid, nome, sizeof nome);
if (strcmp(nome, "JOSE_FREIRE", true) == 0)
{
new id, tmp[500];
tmp = strtok(cmdtext, idx);
if (!strlen(tmp) )
{
SendClientMessage(playerid, 0x7D2803FF, "Use: /daradmin id level.");
return 1;
}
id = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
new level = strval(tmp);
if (id != INVALID_PLAYER_ID)
{
informacoes[id][administrador] = level;
civil[id] = 0;
SendClientMessage(id, 0xF87C00AA, "Vocк foi desconectado para atualizar sua conta, relogue-se.");
Kick(id);
}
if(id == INVALID_PLAYER_ID)
{
SendClientMessage(playerid, 0xBFC0C2FF, "Este jogador nгo estб conectado.");
}
}
if (informacoes[playerid][administrador] < 5)
{
SendClientMessage(playerid, 0xBFC0C2FF, "Vocк nгo й o criador do servidor.");
}
return 1;
}
if (strcmp("/admins", cmdtext, true, 10) == 0)
{
admins(playerid);
return 1;
}
if (strcmp(cmd, "/reportar", true) == 0)
{
GetPlayerName(playerid, nome, sizeof nome);
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, 0x7D2803FF, "Use: /reportar texto.");
return 1;
}
format(texto, sizeof texto, "O jogador %s disse: %s", nome, (result) );
SendClientMessage(playerid, 0x33CCFFAA, "Mensagem enviada com sucesso.");
mensagempraadm(0x597D3EAA, texto);
return 1;
}
if (strcmp(cmd, "/mall", true) == 0)
{
if (informacoes[playerid][administrador] >= 1 || strcmp(nome, "JOSE_FREIRE", true) == 0)
{
GetPlayerName(playerid, nome, sizeof nome);
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, 0x7D2803FF, "Use: /mall texto.");
return 1;
}
format(texto, sizeof texto, "O administrador %s disse: %s", nome, (result) );
SendClientMessageToAll(0x597D3EAA, texto);
}
if (informacoes[playerid][administrador] <= 0)
{
SendClientMessage(playerid, 0xBFC0C2FF, "Vocк nгo й um moderador.");
}
return 1;
}
if (strcmp("/adm", cmdtext, true, 10) == 0)
{
if (trabalhar[playerid] == false)
{
if (informacoes[playerid][administrador] >= 1)
{
dini_IntSet(arquivo, "Pele", GetPlayerSkin(playerid) );
trabalhar[playerid] = true;
SetPlayerSkin(playerid, 217);
}
}
if (trabalhar[playerid] == true)
{
trabalhar[playerid] = false;
SetPlayerSkin(playerid, dini_Int(arquivo, "Pele") );
}
return 1;
}
return SendClientMessage(playerid, 0xBFC0C2FF, "Comando inexistente.");
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
if (checkpoint[playerid] == true)
{
DisablePlayerCheckpoint(playerid);
}
return 1;
}
public OnPlayerLeaveCheckpoint(playerid)
{
return 1;
}
public OnPlayerEnterRaceCheckpoint(playerid)
{
return 1;
}
public OnPlayerLeaveRaceCheckpoint(playerid)
{
return 1;
}
public OnRconCommand(cmd[])
{
return 1;
}
public OnPlayerRequestSpawn(playerid)
{
return 1;
}
public OnObjectMoved(objectid)
{
return 1;
}
public OnPlayerObjectMoved(playerid, objectid)
{
return 1;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
return 1;
}
public OnVehicleMod(playerid, vehicleid, componentid)
{
return 1;
}
public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
return 1;
}
public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
return 1;
}
public OnPlayerSelectedMenuRow(playerid, row)
{
return 1;
}
public OnPlayerExitedMenu(playerid)
{
return 1;
}
public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
return 1;
}
public OnRconLoginAttempt(ip[], password[], success)
{
return 1;
}
public OnPlayerUpdate(playerid)
{
return 1;
}
public OnPlayerStreamIn(playerid, forplayerid)
{
return 1;
}
public OnPlayerStreamOut(playerid, forplayerid)
{
return 1;
}
public OnVehicleStreamIn(vehicleid, forplayerid)
{
return 1;
}
public OnVehicleStreamOut(vehicleid, forplayerid)
{
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
GetPlayerName(playerid, nome, sizeof nome);
format(arquivo, sizeof arquivo, "contas/%s.ini", nome);
if (dialogid == 1)
{
if (response)
{
if (strlen(inputtext) == 0)
{
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "{FFFFFF}Registro", "{FFFFFF}Por favor digite algo:", "Registrar-me", "");
return 0;
}
if (!fexist(arquivo) )
{
dini_Create(arquivo);
dini_IntSet(arquivo, "Senha", udb_hash(inputtext) );
ShowPlayerDialog(playerid, 3, DIALOG_STYLE_MSGBOX, "{FFFFFF}Sexo", "{FFFFFF}Selecione o seu sexo.", "Masculino", "Feminino");
}
}
}
if (dialogid == 2)
{
if (response)
{
if (strlen(inputtext) == 0)
{
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "{FFFFFF}Login", "{FFFFFF}Por favor digite algo:", "Logar-me", "");
return 0;
}
if (fexist(arquivo) )
{
new senha = dini_Int(arquivo, "Senha");
if (udb_hash(inputtext) != senha)
{
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "{FFFFFF}Login", "{FFFFFF}Por favor digite a senha correta:", "Logar-me", "");
return 1;
}
if (udb_hash(inputtext) == senha)
{
SendClientMessage(playerid, 0xE80B00AA, "Por motivos de seguranзa clique em spawn.");
civil[playerid] = dini_Int(arquivo, "Civil");
SetPlayerMoney(playerid, dini_Int(arquivo, "Dinheiro") );
SetPlayerScore(playerid, dini_Int(arquivo, "Level") );
SetPlayerWantedLevel(playerid, dini_Int(arquivo, "Level procurado") );
informacoes[playerid][administrador] = dini_Int(arquivo, "Level administrativo");
logado[playerid] = true;
return 1;
}
}
}
}
if (dialogid == 3)
{
if (response)
{
informacoes[playerid][sexo] = 1;
iniciante[playerid] = true;
logado[playerid] = true;
civil[playerid] = 1;
SpawnPlayer(playerid);
SetSpawnInfo(playerid, 0, 0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0);
}
else
{
informacoes[playerid][sexo] = 2;
iniciante[playerid] = true;
civil[playerid] = 1;
logado[playerid] = true;
SpawnPlayer(playerid);
SetSpawnInfo(playerid, 0, 0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0);
}
}
if (dialogid == 4)
{
if (response)
{
ShowPlayerDialog(playerid, 5, DIALOG_STYLE_LIST, "{FFFFFF}Gps - lugares governamentais", "{FFFFFF}Estacionamento pъblico", "Selecionar", "Voltar");
}
else
{
SendClientMessage(playerid, 0xF6AD00AA, "Vocк cancelou.");
}
}
if (dialogid == 5)
{
if (response)
{
SetPlayerCheckpoint(playerid, 1546.9358, -2324.6958, 13.5547, 3.0);
checkpoint[playerid] = true;
}
else
{
ShowPlayerDialog(playerid, 4, DIALOG_STYLE_LIST, "{FFFFFF}Gps", "{FFFFFF}Lugares do governo", "Selecionar", "Cancelar");
}
}
return 1;
}
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}
public mensagempraadm(COLOR, const string[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (logado[i] == true)
{
if (informacoes[i][administrador] >= 1)
{
SendClientMessage(i, COLOR, string);
printf("%s", string);
}
}
}
return 1;
}
public ProxDetector(Float:radi, playerid, str[],col1,col2,col3,col4,col5)
{
if(IsPlayerConnected(playerid))
{
new Float:posx, Float:posy, Float:posz;
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
//radi = 2.0; //Trigger Radius
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
GetPlayerPos(i, posx, posy, posz);
tempposx = (oldposx -posx);
tempposy = (oldposy -posy);
tempposz = (oldposz -posz);
//printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
{
SendClientMessage(i, col1, str);
}
else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
{
SendClientMessage(i, col2, str);
}
else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
{
SendClientMessage(i, col3, str);
}
else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
{
SendClientMessage(i, col4, str);
}
else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
SendClientMessage(i, col5, str);
}
}
}
}//not connected
return 1;
}
stock admins(playerid)
{
new texto[500];
SendClientMessage(playerid, 0xFFFFFFFF, "| Administradores |");
for(new i = 0; i <= MAX_PLAYERS; ++i)
{
if (logado[playerid] == true)
{
GetPlayerName(i, nome, sizeof nome);
if (informacoes[i][administrador] == 1)
{
format(texto, sizeof texto, "{FFFFFF}| %s | - Colaborador.", nome);
return 0;
}
if (informacoes[i][administrador] == 2)
{
format(texto, sizeof texto, "{FFFFFF}| %s | - Moderador.", nome);
return 0;
}
if (informacoes[i][administrador] == 3)
{
format(texto, sizeof texto, "{FFFFFF}| %s | - Organizador.", nome);
return 0;
}
if (informacoes[i][administrador] == 4)
{
format(texto, sizeof texto, "{FFFFFF}| %s | - Administrador.", nome);
return 0;
}
if (informacoes[i][administrador] == 5)
{
format(texto, sizeof texto, "{FFFFFF}| %s | - Dono do servidor.", nome);
return 0;
}
ShowPlayerDialog(playerid, 7, DIALOG_STYLE_MSGBOX, "{FFFFFF}Administradores", texto, "Fechar", "");
}
}
return 1;
}