25.01.2011, 12:02
pawn Код:
#include <a_samp>
#include <dini>
#include <dudb>
enum info
{
licencaterrestre,
sexo
}
new arquivo[500];
new logado[MAX_PLAYERS], iniciante[MAX_PLAYERS], primeiravez[MAX_PLAYERS], veiculotl[MAX_PLAYERS], emteste[MAX_PLAYERS];
new informacoes[MAX_PLAYERS][info];
forward carrolt(carid);
main()
{
print("\n");
print("Brasil play sa-mp.");
print("\n");
}
public OnGameModeInit()
{
UsePlayerPedAnims();
DisableInteriorEnterExits();
SetGameModeText("Bps");
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
AddStaticVehicle(420, -1754.99609375, 954.83312988, 24.59218788, 90.00000000, 6, 6);
AddStaticVehicle(426, -2072.7434082031, -82.897842407227, 34.984062194824, 180.0, 1, 1);
SetVehicleNumberPlate(2, "Auto - escola");
CreatePickup(1318, 1, -2027.0241699219, -101.87073516846, 35.1640625, -1);
CreatePickup(1318, 1, -2029.2846679688, -119.68843078613, 1035.171875, -1);
CreatePickup(1318, 1, -2027.3057861328, -103.9515914917, 1035.171875, -1);
CreatePickup(1318, 1, -2030.2777099609, -120.91748046875, 35.174468994141, -1);
CreatePickup(1239, 1, -2026.7974, -114.3470, 1035.1719, -1);
return 1;
}
public OnGameModeExit()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
dini_IntSet(arquivo, "Licenзa terrestre", informacoes[i][licencaterrestre]);
dini_IntSet(arquivo, "Roupa", GetPlayerSkin(i) );
}
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
SpawnPlayer(playerid);
return 1;
}
public OnPlayerConnect(playerid)
{
new login[256], registro[256];
format(arquivo, sizeof arquivo, "contas/%s.ini", nome(playerid) );
if (fexist(arquivo) )
{
format(login, sizeof login, "{FFFFFF}Bem vindo %s.\n\nPor favor digite sua senha.", nome(playerid) );
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "{FFFFFF}Login", login, "Logar", "");
SetPlayerColor(playerid, 0xFFFFFFFF);
}
if (!fexist(arquivo) )
{
format(registro, sizeof registro, "{FFFFFF}Bem vindo %s.\n\nPor favor digite uma senha.", nome(playerid) );
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "{FFFFFF}Registro", registro, "Registrar", "");
SetPlayerColor(playerid, 0xFFFFFFFF);
}
emteste[playerid] = 0;
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
if (primeiravez[playerid] == 1)
{
primeiravez[playerid] = 0;
}
dini_IntSet(arquivo, "Roupa", GetPlayerSkin(playerid) );
dini_IntSet(arquivo, "Licenзa terrestre", informacoes[playerid][licencaterrestre]);
return 1;
}
public OnPlayerSpawn(playerid)
{
if (logado[playerid] == 1)
{
if (iniciante[playerid] == 1)
{
if (primeiravez[playerid] == 1)
{
if (informacoes[playerid][sexo] == 1)
{
SetPlayerSkin(playerid, 23);
}
if (informacoes[playerid][sexo] == 2)
{
SetPlayerSkin(playerid, 56);
}
}
SetPlayerPos(playerid, -1752.5930, 961.8002, 24.8828);
SetPlayerFacingAngle(playerid, 180.000);
SetCameraBehindPlayer(playerid);
}
if (primeiravez[playerid] == 0)
{
SetPlayerSkin(playerid, dini_Int(arquivo, "Roupa") );
}
}
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 OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/entrarauto", cmdtext, true, 10) == 0)
{
if (IsPlayerInRangeOfPoint(playerid, 1.0, -2027.0241699219, -101.87073516846, 35.1640625) )
{
SetPlayerInterior(playerid, 3);
SetPlayerPos(playerid, -2029.2846679688, -119.68843078613, 1035.171875);
}
return 1;
}
if (strcmp("/sairauto", cmdtext, true, 10) == 0)
{
if (IsPlayerInRangeOfPoint(playerid, 1.0, -2029.2846679688, -119.68843078613, 1035.171875) )
{
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid, -2027.0241699219, -101.87073516846, 35.1640625);
}
}
if (strcmp("/localteste", cmdtext, true, 10) == 0)
{
if (IsPlayerInRangeOfPoint(playerid, 1.0, -2027.3057861328, -103.9515914917, 1035.171875) )
{
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid, -2030.2777099609, -120.91748046875, 35.174468994141);
}
}
if (strcmp("/sairlocalteste", cmdtext, true, 10) == 0)
{
if (IsPlayerInRangeOfPoint(playerid, 1.0, -2030.2777099609, -120.91748046875, 35.174468994141) )
{
SetPlayerInterior(playerid, 3);
SetPlayerPos(playerid, -2027.3057861328, -103.9515914917, 1035.171875);
}
}
if (strcmp("/testedelicenca", cmdtext, true, 10) == 0)
{
if (IsPlayerInRangeOfPoint(playerid, 1.0, -2026.7974, -114.3470, 1035.1719) )
{
ShowPlayerDialog(playerid, 4, DIALOG_STYLE_MSGBOX, "{FFFFFF}Licenзas", "{FFFFFF}Olб agora vocк estб prestes a comecar um teste, os \ntestes serгo em ordem porйm pъblicos. Para comeзar \nbasta clicar no botгo 'comeзar'.", "Comeзar", "Cancelar");
}
}
return 0;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if (newstate == 0 || newstate == 1 || newstate == 2 && newstate == 3)
{
if (carrolt(GetPlayerVehicleID(playerid) ) )
{
if (emteste[playerid] == 0)
{
SendClientMessage(playerid, 0x87AF32AA, "Vocк nгo estб em nenhum teste.");
RemovePlayerFromVehicle(playerid);
}
}
}
return 1;
}
public OnPlayerEnterCheckpoint(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)
{
if (newkeys == 16 && GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
{
OnPlayerCommandText(playerid, "/entrarauto");
OnPlayerCommandText(playerid, "/sairauto");
OnPlayerCommandText(playerid, "/localteste");
OnPlayerCommandText(playerid, "/sairlocalteste");
OnPlayerCommandText(playerid, "/testedelicenca");
}
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 login[256], registro[256];
format(arquivo, sizeof arquivo, "contas/%s.ini", nome(playerid) );
if (dialogid == 1)
{
if (response)
{
if (strlen(inputtext) == 0)
{
format(login, sizeof login, "{FFFFFF}Bem vindo %s.\n\nPor favor digite algo.", nome(playerid) );
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "{FFFFFF}Login", login, "Logar", "");
return 0;
}
new senha = dini_Int(arquivo, "Senha");
if (udb_hash(inputtext) != senha)
{
format(login, sizeof login, "{FFFFFF}Bem vindo %s.\n\nPor favor digite a senha correta.", nome(playerid) );
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "{FFFFFF}Login", login, "Logar", "");
}
if (udb_hash(inputtext) == senha)
{
logado[playerid] = 1;
iniciante[playerid] = dini_Int(arquivo, "Iniciante");
informacoes[playerid][licencaterrestre] = dini_Int(arquivo, "Licenзa terrestre");
informacoes[playerid][sexo] = dini_Int(arquivo, "Sexo");
SetSpawnInfo(playerid, 0, 0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
}
}
}
if (dialogid == 2)
{
if (response)
{
if (strlen(inputtext) == 0)
{
format(registro, sizeof registro, "{FFFFFF}Bem vindo %s.\n\nPor favor digite algo.", nome(playerid) );
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "{FFFFFF}Registro", registro, "Registrar", "");
return 0;
}
if (!fexist(arquivo) )
{
logado[playerid] = 1;
dini_Create(arquivo);
dini_IntSet(arquivo, "Senha", udb_hash(inputtext) );
ShowPlayerDialog(playerid, 3, DIALOG_STYLE_MSGBOX, "{FFFFFF}Sexo", "{FFFFFF}Por favor selecione o seu sexo.", "Masculino", "Feminino");
}
}
}
if (dialogid == 3)
{
if (response)
{
informacoes[playerid][sexo] = 1;
informacoes[playerid][licencaterrestre] = 0;
iniciante[playerid] = 1;
primeiravez[playerid] = 1;
dini_IntSet(arquivo, "Iniciante", iniciante[playerid]);
dini_IntSet(arquivo, "Sexo", informacoes[playerid][sexo]);
SetSpawnInfo(playerid, 0, 0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
}
else
{
informacoes[playerid][sexo] = 2;
informacoes[playerid][licencaterrestre] = 0;
veiculotl[playerid] = 0;
iniciante[playerid] = 1;
primeiravez[playerid] = 1;
dini_IntSet(arquivo, "Iniciante", iniciante[playerid]);
dini_IntSet(arquivo, "Sexo", informacoes[playerid][sexo]);
SetSpawnInfo(playerid, 0, 0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);
}
}
if (dialogid == 4)
{
if (response)
{
if (veiculotl[playerid] == 1)
{
SendClientMessage(playerid, 0x87AF32AA, "Alguйm jб estб fazendo o teste.");
}
if (veiculotl[playerid] == 0)
{
if (informacoes[playerid][licencaterrestre] == 0)
{
emteste[playerid] = 1;
veiculotl[playerid] = 1;
PutPlayerInVehicle(playerid, 2, 0);
}
}
}
}
return 1;
}
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}
public carrolt(carid)
{
if (carid == 2)
{
return 1;
}
return 1;
}
stock nome(playerid)
{
new jogador[MAX_PLAYER_NAME];
GetPlayerName(playerid, jogador, sizeof jogador);
return jogador;
}