20.02.2012, 01:47
(
Последний раз редактировалось Jason`; 17.03.2012 в 04:27.
)
Bem, jб faz um tempo que estava pra postar este game mode, mas demorei por um motivo que explicarei ao fim do tуpico.
Cуdigo Pequeno nгo vejo necessidade de postar em pastebin:
Script:
Bem, lamentando muito venho informar que nгo pude testar o game mode pois meu wamp server nгo conecta de jeito nenhum ! Porйm, qualquer bug encontrado por alguйm que venha a utilizar peзo que poste para que eu tente resolver no prуprio script.
Espero que gostem!
Cуdigo Pequeno nгo vejo necessidade de postar em pastebin:
Script:
pawn Код:
/*
Base MySQL Gang War
by Pedro Miranda
*/
#include <a_samp>
#include <a_mysql>
#include <sscanf2>
#include <foreach>
#include <YSI\y_commands>
#define GANGS (5)
#define BRANCO 0xFFFFFFAA
#define AMARELO 0xF6F600AA
#define VERMELHO 0xE31919AA
#define VERDE 0x00CD00AA
#define AZUL 0x0000FFAA
#define CIANO 0x00FFFFAA
#define TEMA 0xFA8072AA
#define COR_AZTECAS 0x2641FEC8
#define COR_GROOVE 0x00D900C8
#define COR_VAGOS 0xFFC801C8
#define COR_BALLAS 0x9900FFC8
#define AZTECAS (1)
#define GROOVE (2)
#define VAGOS (3)
#define BALLAS (4)
#define DIALOG_REGISTRO (1)
#define DIALOG_LOGIN (2)
#define THREAD_CHECAR_CONTA (1)
#define THREAD_CHECAR_SENHA (2)
#define THREAD_CARREGAR_CONTA (3)
#define THREAD_CARREGAR_GANG (4)
#define HOST "localhost"
#define USER "root"
#define DB "samp"
#define PASS ""
//---------------------------------------------------
new
String[128],
Query[256],
Conexao;
new
LoginAttempts[MAX_PLAYERS];
enum pInfo
{
bool:pLogado,
pGang,
pAdmin,
pMatou,
pMorreu,
pDinheiro
};
new
PlayerInfo[MAX_PLAYERS][pInfo],
gPlayerName[MAX_PLAYERS][MAX_PLAYER_NAME];
enum GGInfo
{
Mataram,
Morreram
};
new
GangInfo[GANGS][GGInfo];
new
VAztecas[11],
VGroove[11],
VVagos[11],
VBallas[11];
//---------------------------------------------------
new
Text:txtPrincipal;
//---------------------------------------------------
main()
{
print("Basic MySQL Gang War");
print("by Pedro Miranda");
}
//---------------------------------------------------
public OnGameModeInit()
{
SendRconCommand("hostname Base MySQL Gang War");
SendRconCommand("mapname Los Santos");
SendRconCommand("gamemodetext MySQL 1.0");
//Conexao
iniciarConexao();
// desfaзa o comentario abaixo apenas antes de iniciar o gm pela primeira vez pra inserir as gangs no banco de dados
/*for(new i = 1; i < GANGS; i++)
{
format(Query, 128, "INSERT INTO gangInfo (gangID, gangMatou, gangMorreu) VALUES ('%d', 0, 0)", i);
mysql_query(Query);
}*/
//Skins Aztecas
AddPlayerClass(114,2232.2813,-1158.4985,29.7969,0.3858,0,0,0,0,0,0);
AddPlayerClass(115,2232.2813,-1158.4985,29.7969,0.3858,0,0,0,0,0,0);
AddPlayerClass(116,2232.2813,-1158.4985,29.7969,0.3858,0,0,0,0,0,0);
//Skins Groove
AddPlayerClass(105,2232.2813,-1158.4985,29.7969,0.3858,0,0,0,0,0,0);
AddPlayerClass(106,2232.2813,-1158.4985,29.7969,0.3858,0,0,0,0,0,0);
AddPlayerClass(107,2232.2813,-1158.4985,29.7969,0.3858,0,0,0,0,0,0);
AddPlayerClass(269,2232.2813,-1158.4985,29.7969,0.3858,0,0,0,0,0,0);
AddPlayerClass(270,2232.2813,-1158.4985,29.7969,0.3858,0,0,0,0,0,0);
AddPlayerClass(271,2232.2813,-1158.4985,29.7969,0.3858,0,0,0,0,0,0);
//Skins Vagos
AddPlayerClass(108,2232.2813,-1158.4985,29.7969,0.3858,0,0,0,0,0,0);
AddPlayerClass(109,2232.2813,-1158.4985,29.7969,0.3858,0,0,0,0,0,0);
AddPlayerClass(110,2232.2813,-1158.4985,29.7969,0.3858,0,0,0,0,0,0);
//Skins Ballas
AddPlayerClass(102,2232.2813,-1158.4985,29.7969,0.3858,0,0,0,0,0,0);
AddPlayerClass(103,2232.2813,-1158.4985,29.7969,0.3858,0,0,0,0,0,0);
AddPlayerClass(104,2232.2813,-1158.4985,29.7969,0.3858,0,0,0,0,0,0);
//Veiculos Aztecas
VAztecas[0] = CreateVehicle(567,1673.4362,-2110.0366,13.2519,270.6005,103,103,60000);
VAztecas[1] = CreateVehicle(575,1661.6045,-2110.1614,13.2517,270.6003,103,103,60000);
VAztecas[2] = CreateVehicle(412,1663.9532,-2116.4326,13.3836,270.5919,103,103,60000);
VAztecas[3] = CreateVehicle(534,1673.5963,-2116.5295,13.2249,270.6003,103,103,60000);
VAztecas[4] = CreateVehicle(565,1700.1049,-2099.6953,13.2533,179.9370,103,103,60000);
VAztecas[5] = CreateVehicle(566,1696.4332,-2099.6931,13.2536,179.9369,103,103,60000);
VAztecas[6] = CreateVehicle(560,1704.8361,-2125.7949,13.2521,1.3980,103,103,60000);
VAztecas[7] = CreateVehicle(589,1680.1205,-2126.0894,13.2520,359.8218,103,103,60000);
VAztecas[8] = CreateVehicle(522,1690.1974,-2100.5391,13.4042,178.5231,103,103,60000);
VAztecas[9] = CreateVehicle(581,1686.7764,-2100.7271,13.4043,178.5232,103,103,60000);
VAztecas[10] = CreateVehicle(487,1699.0925,-2084.2708,17.7637,180.0375,103,103,60000);
//Veiculos Groove
VGroove[0] = CreateVehicle(567,2470.4524,-1670.4611,13.0229,10.7682,86,86,60000);
VGroove[1] = CreateVehicle(575,2473.0684,-1691.9166,13.2192,359.7195,86,86,60000);
VGroove[2] = CreateVehicle(412,2489.3474,-1682.5742,13.0412,271.4998,86,86,60000);
VGroove[3] = CreateVehicle(534,2497.4470,-1684.7703,13.1170,10.5016,86,86,60000);
VGroove[4] = CreateVehicle(565,2505.7383,-1677.0964,13.0818,327.5858,86,86,60000);
VGroove[5] = CreateVehicle(566,2509.7136,-1686.9553,13.2652,49.3267,86,86,60000);
VGroove[6] = CreateVehicle(560,2516.8506,-1672.1951,13.6798,64.4007,86,86,60000);
VGroove[7] = CreateVehicle(589,2498.1560,-1656.2767,13.0915,78.9987,86,86,60000);
VGroove[8] = CreateVehicle(522,2507.5623,-1651.7622,13.2636,139.3953,86,86,60000);
VGroove[9] = CreateVehicle(581,2505.9907,-1650.4805,13.2750,140.5256,86,86,60000);
VGroove[10] = CreateVehicle(487,2526.8357,-1677.8053,20.1069,89.2377,86,86,60000);
//Veiculos Vagos
VVagos[0] = CreateVehicle(567,2357.8831,-1139.9778,27.6011,182.6296,6,6,60000);
VVagos[1] = CreateVehicle(575,2352.8738,-1140.1923,27.4083,182.6295,6,6,60000);
VVagos[2] = CreateVehicle(412,2347.5793,-1140.4194,27.2047,182.6294,6,6,60000);
VVagos[3] = CreateVehicle(534,2343.6384,-1140.5900,27.0543,182.5253,6,6,60000);
VVagos[4] = CreateVehicle(565,2358.3364,-1162.6302,27.3047,356.8425,6,6,60000);
VVagos[5] = CreateVehicle(566,2348.4182,-1162.2776,27.0646,356.8425,6,6,60000);
VVagos[6] = CreateVehicle(560,2342.7288,-1161.9636,26.9288,356.8426,6,6,60000);
VVagos[7] = CreateVehicle(589,2337.2544,-1161.6615,26.7981,356.8425,6,6,60000);
VVagos[8] = CreateVehicle(522,2332.6045,-1161.6626,26.5396,358.3024,6,6,60000);
VVagos[9] = CreateVehicle(581,2329.3721,-1161.5668,26.5404,358.3022,6,6,60000);
VVagos[10] = CreateVehicle(487,2311.3408,-1138.4169,27.3804,181.7830,6,6,60000);
//Veiculos Ballas
VBallas[0] = CreateVehicle(567,2102.5464,-1275.2994,25.1959,179.2781,5,5,60000);
VBallas[1] = CreateVehicle(575,2088.7524,-1313.0924,23.6900,87.4095,5,5,60000);
VBallas[2] = CreateVehicle(412,2088.6704,-1317.0100,23.6893,90.3818,5,5,60000);
VBallas[3] = CreateVehicle(534,2088.5869,-1320.8147,23.6892,90.7889,5,5,60000);
VBallas[4] = CreateVehicle(565,2088.4971,-1324.4808,23.6999,90.4498,5,5,60000);
VBallas[5] = CreateVehicle(566,2088.5886,-1328.5143,23.6897,92.2996,5,5,60000);
VBallas[6] = CreateVehicle(560,2088.6782,-1332.1604,23.6893,91.9941,5,5,60000);
VBallas[7] = CreateVehicle(589,2088.7927,-1335.9547,23.6893,89.8008,5,5,60000);
VBallas[8] = CreateVehicle(522,2097.7356,-1277.5986,25.0659,180.1497,5,5,60000);
VBallas[9] = CreateVehicle(581,2094.7959,-1277.6062,25.0687,180.1498,5,5,60000);
VBallas[10] = CreateVehicle(487,2085.1526,-1351.2300,24.1878,356.2827,5,5,60000);
//TextDraw
txtPrincipal = TextDrawCreate(2.000000, 432.000000, "Base Gang War MySQL v1.0 by Pedro Miranda"); //Mude se quiser
TextDrawSetOutline(txtPrincipal, 1);
TextDrawFont(txtPrincipal, 3);
TextDrawLetterSize(txtPrincipal, 0.509999, 1.5);
TextDrawUseBox(txtPrincipal, 1);
TextDrawBoxColor(txtPrincipal, 0x000000AA);
TextDrawTextSize(txtPrincipal, 640, 0);
return 1;
}
public OnGameModeExit()
{
TextDrawDestroy(txtPrincipal);
fecharConexao();
return 1;
}
public OnPlayerConnect(playerid)
{
TextDrawShowForPlayer(playerid, txtPrincipal);
GetPlayerName(playerid, gPlayerName[playerid], MAX_PLAYER_NAME);
format(Query, 90, "SELECT * FROM playerContas WHERE playerNome = '%s'", gPlayerName[playerid]);
mysql_query(Query, THREAD_CHECAR_CONTA, playerid);
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
switch(classid)
{
case 0 .. 2:
{
PlayerInfo[playerid][pGang] = 1;
GameTextForPlayer(playerid, "~b~Los Aztecas", 1000, 1);
}
case 3 .. 8:
{
PlayerInfo[playerid][pGang] = 2;
GameTextForPlayer(playerid, "~g~Groove Street", 1000, 1);
}
case 9 .. 11:
{
PlayerInfo[playerid][pGang] = 3;
GameTextForPlayer(playerid, "~y~Los Vagos", 1000, 1);
}
case 12 .. 14:
{
PlayerInfo[playerid][pGang] = 4;
GameTextForPlayer(playerid, "~p~Ballas", 1000, 1);
}
}
SetPlayerPos(playerid,1025.5751,-2140.7637,39.2032);
SetPlayerCameraPos(playerid,1019.7552,-2141.0266,37.7274);
SetPlayerCameraLookAt(playerid,1021.9974,-2140.9907,38.3012);
SetPlayerFacingAngle(playerid, 82.6125);
return 1;
}
public OnPlayerSpawn(playerid)
{
if(!PlayerInfo[playerid][pLogado]) return Kick(playerid);
TextDrawShowForPlayer(playerid, txtPrincipal);
switch(PlayerInfo[playerid][pGang])
{
case AZTECAS:
{
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid, 1675.1698,-2121.0886,13.5469);
SetPlayerFacingAngle(playerid, 316.1795);
SetPlayerVirtualWorld(playerid, 0);
}
case GROOVE:
{
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid, 2495.3799,-1689.3333,14.3655);
SetPlayerFacingAngle(playerid,1.6557);
SetPlayerVirtualWorld(playerid,0);
}
case VAGOS:
{
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid, 2351.9451,-1168.7489,27.9805);
SetPlayerFacingAngle(playerid, 1.5253);
SetPlayerVirtualWorld(playerid, 0);
}
case BALLAS:
{
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid, 2090.9136,-1279.1019,26.1271);
SetPlayerFacingAngle(playerid,182.9264);
SetPlayerVirtualWorld(playerid,0);
}
}
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 100);
GivePlayerWeapon(playerid, 24, 9999);
GivePlayerWeapon(playerid, 25, 9999);
GivePlayerWeapon(playerid, 29, 9999);
GivePlayerWeapon(playerid, 31, 9999);
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
TextDrawHideForPlayer(playerid, txtPrincipal);
PlayerInfo[playerid][pMorreu] ++;
PlayerInfo[killerid][pMatou]++;
new
gang = PlayerInfo[killerid][pGang],
gang2 = PlayerInfo[playerid][pGang];
GangInfo[gang][Mataram]++;
GangInfo[gang2][Morreram] ++;
SendDeathMessage(playerid, killerid, reason);
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
new
vehicleid = GetPlayerVehicleID(playerid);
if(IsAztecasCar(vehicleid) && PlayerInfo[playerid][pGang] != AZTECAS)
{
SendClientMessage(playerid, COR_AZTECAS, "Vocк nгo й dos Aztecas por isso nгo possui a chave deste veнculo!");
RemovePlayerFromVehicle(playerid);
}
else if(IsGrooveCar(vehicleid) && PlayerInfo[playerid][pGang] != GROOVE)
{
SendClientMessage(playerid, COR_GROOVE, "Vocк nгo й da Groove por isso nгo possui a chave deste veнculo!");
RemovePlayerFromVehicle(playerid);
}
else if(IsVagosCar(vehicleid) && PlayerInfo[playerid][pGang] != VAGOS)
{
SendClientMessage(playerid, COR_VAGOS, "Vocк nгo й dos Vagos por isso nгo possui a chave deste veнculo!");
RemovePlayerFromVehicle(playerid);
}
else if(IsBallasCar(vehicleid) && PlayerInfo[playerid][pGang] != BALLAS)
{
SendClientMessage(playerid, COR_BALLAS, "Vocк nгo й dos Ballas por isso nгo possui a chave deste veнculo!");
RemovePlayerFromVehicle(playerid);
}
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
TextDrawHideForPlayer(playerid, txtPrincipal);
switch(reason)
{
case 0: format(String, 100, "%s deixou o servidor por crash/erro de conexгo.", gPlayerName[playerid]);
case 1: format(String, 100, "%s deixou o servidor por conta prуpria.", gPlayerName[playerid]);
case 2: format(String, 100, "%s deixou o servidor kickado ou banido.", gPlayerName[playerid]);
}
SendClientMessageToAll(CIANO, String);
format(Query, 256, "UPDATE playerContas SET playerAdmin = '%d', playerMatou = '%d', playerMorreu = '%d', playerDinheiro = '%d'", PlayerInfo[playerid][pAdmin], PlayerInfo[playerid][pMatou], PlayerInfo[playerid][pMorreu], GetPlayerMoneyEx(playerid));
mysql_query(Query);
return 1;
}
public OnPlayerUpdate(playerid)
{
if(GetPlayerMoney(playerid) > GetPlayerMoneyEx(playerid))
{
new
valor = GetPlayerMoney(playerid) - GetPlayerMoneyEx(playerid);
GivePlayerMoneyEx(playerid, -valor);
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_REGISTRO)
{
if(!response)
return Kick(playerid);
if(response)
{
if(strlen(inputtext) < 5 || strlen(inputtext) > 32)
return ShowPlayerDialog(playerid, DIALOG_REGISTRO, DIALOG_STYLE_PASSWORD, "{FFFFFF}Registro", "{FFFFFF}Digite Uma Senha Com No Mнnimo 5 e no Mбximo 32 Caracteres.", "Registrar", "Cancelar");
format(Query, 256, "INSERT INTO playerContas (playerNome, playerSenha, playerAdmin, playerMatou, playerMorreu, playerDinheiro) VALUES ('%s', '%s', 0, 0, 0, 10000)");
mysql_query(Query);
return 1;
}
}
if(dialogid == DIALOG_LOGIN)
{
if(!response)
return Kick(playerid);
if(response)
{
if(!strlen(inputtext))
return ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "{FFFFFF}Login", "{FFFFFF}Digite Sua Senha Para Logar.", "Logar", "Cancelar");
format(Query, 128, "SELECT * FROM playerContas WHERE playerNome = '%s' AND playerSenha = '%s'", gPlayerName[playerid], inputtext);
mysql_query(Query, THREAD_CHECAR_SENHA, playerid);
return 1;
}
}
return 1;
}
public OnQueryFinish(query[], resultid, extraid, connectionHandle)
{
if(resultid == THREAD_CHECAR_CONTA)
{
mysql_store_result();
if(mysql_num_rows())
{
format(String, sizeof(String), "{0000FF}%s{FFFFFF} Seja Bem Vindo\nDigite Sua Senha Para Logar.", gPlayerName[extraid]);
ShowPlayerDialog(extraid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", String, "Logar", "Cancelar");
}
else
{
format(String, sizeof(String), "{0000FF}%s{FFFFFF} Seja Bem Vindo\nDigite Uma Senha Para Registrar.", gPlayerName[extraid]);
ShowPlayerDialog(extraid, DIALOG_REGISTRO, DIALOG_STYLE_PASSWORD, "Registro", String, "Registrar", "Cancelar");
}
mysql_free_result();
return 1;
}
if(resultid == THREAD_CHECAR_SENHA)
{
mysql_store_result();
if(mysql_num_rows())
{
LoginAttempts[extraid] = 0;
PlayerInfo[extraid][pLogado] = true;
SendClientMessage(extraid, VERDE, "Logado com sucesso! Escolha sua gangue.");
format(String, 60, "%s Logou no Servidor!", gPlayerName[extraid]);
SendClientMessageToAll(VERMELHO, String);
format(Query, 90, "SELECT * FROM playerContas WHERE playerNome = '%s'", gPlayerName[extraid]);
mysql_query(Query, THREAD_CARREGAR_CONTA, extraid);
}
else
{
SendClientMessage(extraid, VERMELHO, "Senha Incorreta, Se Errar a Senha 5 Vezes Serб Banido.");
ShowPlayerDialog(extraid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "Senha Incorreta\nDigite Sua Verdadeira Senha Para Logar.", "Logar", "Cancelar");
LoginAttempts[extraid]++;
if(LoginAttempts[extraid] == 5)
return Ban(extraid);
}
return 1;
}
if(resultid == THREAD_CARREGAR_CONTA)
{
mysql_store_result();
while(mysql_retrieve_row())
{
mysql_get_field("playerAdmin", String);
PlayerInfo[extraid][pAdmin] = strval(String);
mysql_get_field("playerMatou", String);
PlayerInfo[extraid][pMatou] = strval(String);
mysql_get_field("playerMorreu", String);
PlayerInfo[extraid][pMorreu] = strval(String);
mysql_get_field("playerDinheiro", String);
SetPlayerMoney(extraid, strval(String));
}
mysql_free_result();
return 1;
}
if(resultid == THREAD_CARREGAR_GANG)
{
new
gangID;
mysql_store_result();
while(mysql_retrieve_row())
{
mysql_get_field("gangID", String);
gangID = strval(String);
mysql_get_field("gangMatou", String);
GangInfo[gangID][Mataram] = strval(String);
mysql_get_field("gangMorreu", String);
GangInfo[gangID][Morreram] = strval(String);
}
return 1;
}
return 1;
}
//---------------------------------------------------
stock iniciarConexao()
{
Conexao = mysql_connect(HOST, USER, DB, PASS);
mysql_debug(1);
if(mysql_ping(Conexao) == -1)
{
print("=> Conexгo Perdida");
SendRconCommand("exit");
}
else
{
printf("=> Conectado ao Banco de Dados %s - Ping: %d", DB, mysql_ping(Conexao));
}
mysql_query("CREATE TABLE IF NOT EXISTS playerContas (playerNome VARCHAR(24) NOT NULL, playerSenha VARCHAR(32) NOT NULL, playerAdmin INT(20) NOT NULL, playerMatou INT(20) NOT NULL, playerMorreu INT(20) NOT NULL, playerDinheiro INT(20) NOT NULL)");
mysql_query("CREATE TABLE IF NOT EXISTS gangInfo (gangID INT(20) NOT NULL, gangMatou INT(20) NOT NULL, gangMorreu INT(20) NOT NULL)");
mysql_query("SELECT * FROM infoGang", THREAD_CARREGAR_GANG);
return 1;
}
stock fecharConexao()
{
foreach(Player, i)
{
format(Query, 256, "UPDATE playerContas SET playerAdmin = '%d', playerMatou = '%d', playerMorreu = '%d', playerDinheiro = '%d'", PlayerInfo[i][pAdmin], PlayerInfo[i][pMatou], PlayerInfo[i][pMorreu], GetPlayerMoneyEx(i));
mysql_query(Query);
}
for(new i = 1; i < sizeof(GangInfo); i++)
{
format(Query, 128, "UPDATE gangInfo SET gangMatou = '%d', gangMorreu = '%d' WHERE id = '%d'", GangInfo[i][Mataram], GangInfo[i][Morreram], i);
mysql_query(Query);
}
mysql_close(Conexao);
return 1;
}
//---------------------------------------------------
stock GivePlayerMoneyEx(playerid, valor)
{
GivePlayerMoney(playerid, valor);
PlayerInfo[playerid][pDinheiro] = GetPlayerMoney(playerid);
return 1;
}
stock ResetPlayerMoneyEx(playerid)
{
ResetPlayerMoney(playerid);
PlayerInfo[playerid][pDinheiro] = 0;
return 1;
}
stock SetPlayerMoney(playerid, valor)
{
ResetPlayerMoneyEx(playerid);
GivePlayerMoneyEx(playerid, valor);
return 1;
}
stock GetPlayerMoneyEx(playerid)
{
return PlayerInfo[playerid][pDinheiro];
}
//---------------------------------------------------
stock gangNome(gangid)
{
new gangnome[32];
switch(gangid)
{
case 1: gangnome = "Los Aztecas";
case 2: gangnome = "Groove Street";
case 3: gangnome = "Los Vagos";
case 4: gangnome = "Ballas";
}
return gangnome;
}
stock gangCor(gangid)
{
new gangcor;
switch(gangid)
{
case 1: gangcor = COR_AZTECAS;
case 2: gangcor = COR_GROOVE;
case 3: gangcor = COR_VAGOS;
case 4: gangcor = COR_BALLAS;
}
return gangcor;
}
//---------------------------------------------------
stock IsAztecasCar(carid)
{
for(new i; i < sizeof(VAztecas); i++)
{
if(carid == i)
{
return 1;
}
}
return 0;
}
stock IsGrooveCar(carid)
{
for(new i; i < sizeof(VGroove); i++)
{
if(carid == i)
{
return 1;
}
}
return 0;
}
stock IsVagosCar(carid)
{
for(new i; i < sizeof(VVagos); i++)
{
if(carid == i)
{
return 1;
}
}
return 0;
}
stock IsBallasCar(carid)
{
for(new i; i < sizeof(VBallas); i++)
{
if(carid == i)
{
return 1;
}
}
return 0;
}
//---------------------------------------------------
stock SendRadioMessage(gang, const string[])
{
foreach(Player, i)
{
if(PlayerInfo[i][pGang] == gang)
{
SendClientMessage(i, gangCor(gang), string);
}
}
return 1;
}
//---------------------------------------------------
YCMD:viraradmin(playerid, params[], ajuda)
{
#pragma unused params
if(ajuda)
return SendClientMessage(playerid, CIANO, "Vocк se torna admin com o uso deste comando.");
if(IsPlayerAdmin(playerid))
{
PlayerInfo[playerid][pAdmin] = 2;
}
else SendClientMessage(playerid, CIANO, "Somente pessoas logadas na rcon!");
return 1;
}
YCMD:daradmin(playerid, params[], ajuda)
{
if(ajuda)
return SendClientMessage(playerid, CIANO, "Torna um jogador administrador no nнvel especificado.");
new id, level;
if(sscanf(params, "id", id, level))
return SendClientMessage(playerid, VERMELHO, "Use /daradmin [playerID] [Level]");
if(!IsPlayerConnected(id))
return SendClientMessage(playerid, VERMELHO, "Jogador inativo.");
if(level < 0 || level > 2)
return SendClientMessage(playerid, VERMELHO, "Leveis de 1 a 2.");
format(String, sizeof(String), "%s tornou %s administrador nнvel %d.", gPlayerName[playerid], gPlayerName[id], level);
SendClientMessageToAll(CIANO, String);
PlayerInfo[id][pAdmin] = level;
return 1;
}
YCMD:kick(playerid, params[], ajuda)
{
if(ajuda)
return SendClientMessage(playerid, CIANO, "Chuta um jogador pra fora do servidor.");
new id, reason[64];
if(sscanf(params, "ds[64]", id, reason))
return SendClientMessage(playerid, VERMELHO, "Use /kick [playerID] [Motivo]");
if(!IsPlayerConnected(id))
return SendClientMessage(playerid, VERMELHO, "Jogador inativo.");
format(String, sizeof(String), "%s kickou %s, motivo: %s", gPlayerName[playerid], gPlayerName[id], reason);
SendClientMessageToAll(TEMA, String);
Kick(id);
return 1;
}
YCMD:ban(playerid, params[], ajuda)
{
if(ajuda)
return SendClientMessage(playerid, CIANO, "Bane um jogador do servidor.");
new id, reason[64];
if(sscanf(params, "ds[64]", id, reason))
return SendClientMessage(playerid, VERMELHO, "Use /ban [playerID] [Motivo]");
if(!IsPlayerConnected(id))
return SendClientMessage(playerid, VERMELHO, "Jogador inativo.");
format(String, sizeof(String), "%s baniu %s, motivo: %s", gPlayerName[playerid], gPlayerName[id], reason);
SendClientMessageToAll(TEMA, String);
Ban(id);
return 1;
}
YCMD:radio(playerid, params[], ajuda)
{
if(ajuda)
return SendClientMessage(playerid, CIANO, "Envia uma mensagem pelo radio de sua gangue.");
if(isnull(params))
return SendClientMessage(playerid, CIANO, "Use (/r)adio [Texto]");
format(String, sizeof(String), "[Radio %s] - %s: %s", gangNome(PlayerInfo[playerid][pGang]), gPlayerName[playerid], params);
SendRadioMessage(PlayerInfo[playerid][pGang], String);
return 1;
}
YCMD:ajuda(playerid, params[], ajuda)
{
if(ajuda)
return SendClientMessage(playerid, -1, "Mostra ajuda sobre os comandos");
if(isnull(params))
return SendClientMessage(playerid, -1, "Use /ajuda [Comando]");
Command_ReProcess(playerid, params, true);
return 1;
}
YCMD:creditos(playerid, params[], ajuda)
{
#pragma unused params, ajuda
SendClientMessage(playerid, CIANO, "Pedro Miranda, Ricop522 por tirar minhas duvidas, SA:MP Team, ****** e BlueG");
return 1;
}
Espero que gostem!