23.02.2011, 17:37
PHP код:
#include <a_samp>
#include <dini>
#include <dudb>
#include <sscanf2>
#include <zcmd>
CMD:gps(playerid, params[])
{
#pragma unused params
ShowPlayerDialog(playerid, 3, DIALOG_STYLE_LIST, "{9BD233}Gps", "{FFFFFF}Locais governamentais", "Selecionar", "Cancelar");
return 1;
}
new arquivo[150];
new logado[MAX_PLAYERS];
main()
{
print("\n");
print("Servidor conectado.");
print("\n");
}
public OnGameModeInit()
{
UsePlayerPedAnims();
SetGameModeText("Bsc oficial");
AddPlayerClass(0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0);
return 1;
}
public OnGameModeExit()
{
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
return 1;
}
public OnPlayerConnect(playerid)
{
/*Criado por (Ips)Drakins.
new lencara, lennome, underline, nomerpg[20], caracteristicas[56], texto[500], burlo = 0;
underline = 0;
lennome = strlen(nomerpg);
lencara = strlen(caracteristicas);
caracteristicas = "aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ_";
GetPlayerName(playerid, nomerpg, 22);
for(new i; i < lennome; i++)
{
for(new a; a < lencara; ++a)
{
if (nomerpg[i] != caracteristicas[a] && nomerpg[i] != caracteristicas[a] - 32)
++burlo;
}
if (nomerpg[i] == '_')
++underline;
}
if (burlo == (lencara * lennome) - lennome && underline == 1)
{
if (!fexist(arquivo) )
{
format(texto, sizeof texto, "{FFFFFF}Conta: %s.\n\nPor favor digite uma senha:", nome(playerid) );
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "{FFFFFF}Registro", texto, "Registrar-me", "");
}
if (fexist(arquivo) )
{
format(texto, sizeof texto, "{FFFFFF}Conta: %s.\n\nPor favor digite sua senha:", nome(playerid) );
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "{FFFFFF}Login", texto, "Logar-me", "");
}
}
else
{
Kick(playerid);
}*/
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
/*format(arquivo, sizeof arquivo, "contas/%s.ini", nome(playerid) );
if (fexist(arquivo) )
{
dini_IntSet(arquivo, "Dinheiro", GetPlayerMoney(playerid) );
dini_IntSet(arquivo, "Level", GetPlayerScore(playerid) );
}*/
return 1;
}
public OnPlayerSpawn(playerid)
{
/*if (logado[playerid] == 0)
{
Kick(playerid);
}*/
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
return 1;
}
public OnVehicleSpawn(vehicleid)
{
return 1;
}
public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}
public OnPlayerText(playerid, text[])
{
return 1;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
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[])
{
new texto[500];
format(arquivo, sizeof arquivo, "contas/%s.ini", nome(playerid) );
if (dialogid == 1)
{
if (response)
{
if (strlen(inputtext) == 0)
{
format(texto, sizeof texto, "{FFFFFF}Conta: %s\n\nPor favor digite algo:", nome(playerid) );
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "{FFFFFF}Registro", texto, "Registrar-me", "");
return 0;
}
if (!fexist(arquivo) )
{
dini_Create(arquivo);
dini_IntSet(arquivo, "Senha", udb_hash(inputtext) );
printf("%s registrou-se no servidor.", nome(playerid) );
logado[playerid] = 1;
}
}
}
if (dialogid == 2)
{
if (response)
{
if (strlen(inputtext) == 0)
{
format(texto, sizeof texto, "{FFFFFF}Conta: %s\n\nPor favor digite algo:", nome(playerid) );
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "{FFFFFF}Login", texto, "Logar-me", "");
return 0;
}
if (fexist(arquivo) )
{
new senha = dini_Int(arquivo, "Senha");
if (udb_hash(inputtext) != senha)
{
format(texto, sizeof texto, "{FFFFFF}Conta: %s\n\nPor favor digite a senha correta:", nome(playerid) );
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "{FFFFFF}Login", texto, "Logar-me", "");
return 1;
}
if (udb_hash(inputtext) == senha)
{
SetPlayerMoney(playerid, dini_Int(arquivo, "Dinheiro") );
SetPlayerScore(playerid, dini_Int(arquivo, "Level") );
printf("%s entrou no servidor.", nome(playerid) );
logado[playerid] = 1;
return 1;
}
}
}
if (dialogid == 3)
{
if (response)
{
if (listitem == 0)
{
ShowPlayerDialog(playerid, 4, DIALOG_STYLE_LIST, "{9BD233}Gps {FFFFFF}- lugares do governo", "{FFFFFF}Banco", "Selecionar", "Voltar");
}
}
else
{
SendClientMessage(playerid, 0x2FC6D7AA, "Vocк clicou em cancelar.");
}
}
if (dialogid == 4)
{
if (response)
{
if (listitem == 0)
{
SetPlayerCheckpoint(playerid, 2302.8352050781, -16.293621063232, 26.484375, 1.0);
}
}
else
{
ShowPlayerDialog(playerid, 3, DIALOG_STYLE_LIST, "{9BD233}Gps", "{FFFFFF}Locais governamentais", "Selecionar", "Cancelar");
}
}
}
return 1;
}
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}
stock nome(playerid)
{
new jogador[MAX_PLAYER_NAME];
GetPlayerName(playerid, jogador, sizeof jogador);
return jogador;
}