Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // -----------------------------------------------------------------------------
- /*
- |--- Filterscript Clan System - Gang system");
- |-- Script v1.01 Credits Harvey");
- |-- Date 2020 ");
- https://www.facebook.com/B28345/
- */
- // -----------------------------------------------------------------------------
- #include <a_samp>
- #include <MXini>
- #include <file>
- #include <zcmd>
- //CQB Shield System//
- #define RED 0xFF0000FF
- #define GREEN 0x00A200FF
- #define BLUE 0x0000DAFF
- #define ORANGE 0xFFB400FF
- #define WHITE 0xFFFFFFAA
- #define COLOR_BLUE 0x33CCFFAA
- #define red 0xFF0000AA
- #define COLOR_GRAD1 0xB4B5B7FF
- #define COLOR_WHITE 0xFFFFFFAA
- #define FILTERSCRIPT
- #define Dialog_Default 12033
- //Gangs
- #define MAX_GANGS 500
- //------------------------
- //Name System
- new Text3D:playertarget[MAX_PLAYERS];
- //Shield System
- new ShieldObject[MAX_PLAYERS];
- new HasShield[MAX_PLAYERS];
- //------------------------
- //Other Variables
- new tgang[MAX_PLAYERS],inigangname[MAX_GANGS][256],col[MAX_GANGS][256],gangskin[MAX_PLAYERS],id[MAX_PLAYERS] = -1;
- new GangName[MAX_GANGS][256],Gang[MAX_GANGS],GangLvl[MAX_PLAYERS],GName[MAX_GANGS][256];
- new GColor[MAX_GANGS][10],PGang[MAX_PLAYERS],Float:GSpawnX[MAX_GANGS],Float:GSpawnY[MAX_GANGS],Float:GSpawnZ[MAX_GANGS],GSkin[MAX_GANGS][7];
- public OnFilterScriptInit()
- {
- printf( "Started Gangs Filterscript");
- ShowNameTags(false);
- return 1;
- }
- public OnFilterScriptExit()
- {
- for(new i; i<MAX_PLAYERS; i++){SaveAccount(i);}
- printf( "Ended Gangs Filterscript");
- return true;
- }
- enum AutoPlayer
- {
- pVehicle
- };
- new AccInfo[MAX_PLAYERS][AutoPlayer];
- forward VehicleSpawner(playerid,model);
- forward RespawnVehicle(vehicleid);
- forward DeleteVehicle(vehicleid);
- ShowPlayerDefaultDialog( playerid )
- {
- ShowPlayerDialog( playerid, 10, DIALOG_STYLE_LIST, "Vehiculos", "Aviones\nHelicopteros\nMotos\nTodoterreno\nServicio Publico\nBarcos", "Aceptar", "Cancelar" );
- return 1;
- }
- //------------------------------------------------------------------
- //------------------------------------------------------------------
- //------------------------------------------------------------------
- //------------------------------------------------------------------
- public OnPlayerDisconnect(playerid, reason)
- {
- SaveAccount(playerid);
- DestroyObject(ShieldObject[playerid]);//sistema de Shield CQB
- if(AccInfo[playerid][pVehicle] != -1) DeleteVehicle(AccInfo[playerid][pVehicle]);
- Delete3DTextLabel(playertarget[playerid]);//sistema de nombre//
- return true;
- }
- public OnPlayerRequestClass(playerid, classid)
- {
- PGang[playerid] = 0;
- GangLvl[playerid] = 0;
- LoadAccount(playerid);
- return true;
- }
- public OnPlayerSpawn(playerid)
- {
- SetTimerEx("Spawn", 0, false, "i", playerid);
- HasShield[playerid] = 0;//Sistema de escudo CQB
- return true;
- }
- ///---------------------------------------------------------------------------------------------
- ///---------------------------------------------------------------------------------------------
- ///---------------------------------------------------------------------------------------------
- ///-------------------------------Sistema de escudo CQB-----------------------------------------
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- if(newkeys == KEY_JUMP)
- {
- if(HasShield[playerid] == 1)
- {
- new Float: X, Float: Y, Float: Z;
- GetPlayerPos(playerid,X,Y,Z);
- SetPlayerPos(playerid,X,Y,Z);
- ApplyAnimation(playerid,"SWORD","sword_block",50.0,0,1,1,1,1);
- SetTimerEx("TAnim", 500, 0, "i", playerid);
- }
- }
- if(newkeys == KEY_FIRE)
- {
- if(HasShield[playerid] == 1)
- {
- ApplyAnimation(playerid,"SWORD","sword_block",50.0,0,1,1,1,1);
- SetTimerEx("TAnim", 500, 0, "i", playerid);
- }
- }
- if(newkeys == KEY_CROUCH)
- {
- if(HasShield[playerid] == 1)
- {
- new Float: X, Float: Y, Float: Z;
- GetPlayerPos(playerid,X,Y,Z);
- SetPlayerPos(playerid,X,Y,Z);
- ApplyAnimation(playerid,"SWORD","sword_block",50.0,0,1,1,1,1);
- SetTimerEx("TAnim", 500, 0, "i", playerid);
- }
- }
- if(newkeys == KEY_SECONDARY_ATTACK)
- {
- if(HasShield[playerid] == 1)
- {
- HasShield[playerid] = 0;
- DestroyObject(ShieldObject[playerid]);
- SendClientMessage(playerid,RED,"Has dejado el escudo.");
- ClearAnimations(playerid);
- }
- }
- return 1;
- }
- forward TAnim(playerid);
- public TAnim(playerid)
- {
- ApplyAnimation(playerid,"SWORD","sword_block",50.0,0,1,1,1,1);
- return 1;
- }
- ///---------------------------------------------------------------------------------------------
- ///---------------------------------------------------------------------------------------------
- ///---------------------------------------------------------------------------------------------
- ///---------------------------------------------------------------------------------------------
- ///---------------------------------------------------------------------------------------------
- public OnPlayerDeath(playerid, killerid, reason)
- {
- if(killerid != INVALID_PLAYER_ID) SetPlayerScore(killerid, GetPlayerScore(killerid) + 1);
- HasShield[playerid] = 0;///Sistema de escudo CQB
- DestroyObject(ShieldObject[playerid]);//Sistema de escudo CQB
- //Sistema de nombre//-------------------------------------------------------------------------------
- new text[256], Nplayer[MAX_PLAYER_NAME];
- GetPlayerName(playerid, Nplayer, MAX_PLAYER_NAME);
- format(text,sizeof(text),"{%06x}%s{FFFFFF}[%d]\n%s\n%s", GetPlayerColor(playerid) >>> 8, Nplayer, playerid);
- Update3DTextLabelText(playertarget[playerid], 0xFFFFFFFF, text);
- //--------------
- return true;
- }
- public OnPlayerText(playerid, text[])
- {
- new string[256];
- format(string, sizeof(string), "[Equipo: %s] {FFFFFF}%s[ID: %d]: %s",GName[PGang[playerid]], PlayerName(playerid), playerid, text);
- printf("%s", string);
- if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT) { ApplyAnimation(playerid, "PED", "IDLE_CHAT", 4.1, 0, 1, 1, 0, 1000, 1);}
- for(new i; i<MAX_PLAYERS; i++)
- {
- if(PGang[i] == PGang[playerid])
- {
- SendClientMessage(i, GetPlayerColor(playerid), string);
- }
- }
- return 0;
- }
- //-----------------------------------------------------------------------------------------------------------
- //-----------------------------------------------------------------------------------------------------------
- //-----------------------------------------------------------------------------------------------------------
- //-----------------------------------------------------------------------------------------------------------
- //Comandos
- //----------------------------------------------------------------
- COMMAND:clancmds(playerid, params[])
- {
- new Str[2024];
- strcat(Str,"{FF0000}» /invitar {00BFFF} Esta funcion es para invitar a un jugador a tú equipo!\n");
- strcat(Str,"{FF0000}» /clanskins {00BFFF} Cambia la skins dependiendo del rango que tenga el usuario!\n");
- strcat(Str,"{FF0000}» /darrango {00BFFF}Con esta funcion se le puede dar rango a un miembro del equipo!\n");
- strcat(Str,"{FF0000}» /expulsar {00BFFF}Con esta funcion kickeas a un miembro del equipo!\n");
- strcat(Str,"{FF0000}» /salirclan {00BFFF}Con esta funcion abandonas tú equipo !\n");
- ShowPlayerDialog( playerid, Dialog_Default, DIALOG_STYLE_MSGBOX, "Comandos para editar tú equipo:", Str, "Aceptar", "");
- return 1;
- }
- COMMAND:creditos(playerid, params[])
- {
- new Str[2024];
- strcat(Str,"{FF0000}» Sistema de clanes creado por Harvey no robes creditos!\n");
- ShowPlayerDialog( playerid, Dialog_Default, DIALOG_STYLE_MSGBOX, "Comandos para editar tú equipo:", Str, "Aceptar", "");
- return 1;
- }
- CMD:v(playerid, params[])
- {
- if(PGang[playerid] != 0 && GangLvl[playerid] >= 1)
- {
- if(IsPlayerInRangeOfPoint(playerid, 100.0, GSpawnX[ PGang[playerid] ], GSpawnY[ PGang[playerid] ], GSpawnZ[ PGang[playerid] ]))
- //or
- for(new i; i<MAX_GANGS; i++)
- {
- if(PGang[playerid] == i && IsPlayerInRangeOfPoint(playerid, 100.0, GSpawnX[i], GSpawnY[i], GSpawnZ[i]))
- ShowPlayerDefaultDialog(playerid);
- }
- else
- {
- SendClientMessage(playerid, 0xFF0000FF, "No te encuentras en tú base para sacar un vehiculo.");
- }
- }else return SendClientMessage(playerid, 0xFF0000FF, "Necesitas ser soldado para sacar un vehiculo.!");
- return 1;
- }
- //-----------------------------------------------------
- CMD:equipo(playerid, params[])
- {
- if (!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GRAD1, "No eres administrador para usar este comando");
- {
- ShowPlayerDialog(playerid, 1001, DIALOG_STYLE_LIST, "{FF0000}[Equipo]{FFFFFF} - Clan Menu", "\
- Crea un equipo\
- \nEdita tú equipo\
- \nEnviar invitación - Clan\
- \nAbandonar Clan\
- ", "Aceptar", "Cancelar");
- }
- return 1;
- }
- CMD:invitar(playerid, params[])
- {
- if(PGang[playerid] != 0 && GangLvl[playerid] >= 4)
- {
- ShowPlayerDialog(playerid, 3001, DIALOG_STYLE_INPUT, "{FF0000}[Equipo]{FFFFFF} - Gang Invite", "Agrega una id para enviar la invitación:", "Aceptar", "Cancelar");
- }else return SendClientMessage(playerid, 0xFF0000FF, "No perteneces a ningun equipo, Para invitar a un jugador es necesario tener rango nivel 4.");
- return 1;
- }
- CMD:clanskins(playerid, params[])
- {
- if(PGang[playerid] != 0 && GangLvl[playerid] == 6)
- {
- ShowPlayerDialog(playerid, 8001, DIALOG_STYLE_LIST, "{FF0000}[Equipo]{FFFFFF} - Uniformes del equipo", "Uniforme (Soldado) Nivel 1\nUniforme (Cabo) Nivel 2\nUniforme (Sargento) Nivel 3\nUniforme (Teniente) Nivel 4\nUniforme (Capitán) Nivel 5\nUniforme (Mayor General) Nivel 6", "Aceptar", "Cancelar");
- }else return SendClientMessage(playerid, 0xFF0000FF, "Para cambiar el skin de tú equipo necesitas ser nivel 6 .");
- return 1;
- }
- CMD:darrango(playerid, params[])
- {
- if(PGang[playerid] != 0 && GangLvl[playerid] == 6)
- {
- ShowPlayerDialog(playerid, 9001, DIALOG_STYLE_INPUT, "{FF0000}[Equipo]{FFFFFF} - Dar rango", "Coloca la id del jugador:", "Aceptar", "Cancelar");
- }else return SendClientMessage(playerid, 0xFF0000FF, "Para cambiar el rango necesitas tener nivel 6.");
- return 1;
- }
- CMD:expulsar(playerid, params[])
- {
- if(PGang[playerid] != 0 && GangLvl[playerid] >= 5)
- {
- ShowPlayerDialog(playerid, 4001, DIALOG_STYLE_INPUT, "{FF0000}[Equipo]{FFFFFF} - Expulsar miembro", "Coloca la id del jugador para expulsar:", "Aceptar", "Cancelar");
- }else return SendClientMessage(playerid, 0xFF0000FF, "Para expulsar a un jugador es necesario tener rango nivel 5.");
- return 1;
- }
- CMD:salirclan(playerid, params[])
- {
- if(PGang[playerid] > 0)
- {
- ShowPlayerDialog(playerid, 6001, DIALOG_STYLE_MSGBOX, "{FF0000}[Equipo]{FFFFFF} - salir clan", "Estás seguro de salir de tú equipo?", "Si", "No");
- }else return SendClientMessage(playerid, 0xFF0000FF, "Abandonaste tú equipo.!");
- return 1;
- }
- CMD:shield(playerid, params[])
- {
- if(PGang[playerid] != 0 && GangLvl[playerid] >= 1)
- {
- switch(HasShield[playerid])
- {
- case 0://False (They didn't have a Shield before using CMD:shield)
- {
- DestroyObject(ShieldObject[playerid]);
- ApplyAnimation(playerid,"SWORD","sword_block",50.0,0,1,1,1,1);
- ShieldObject[playerid] = CreateObject(1533,2470.573,-1660.366,14.271,0.0,0.0,-90.000); //
- AttachObjectToPlayer(ShieldObject[playerid],playerid,-0.8,0.5,-1.65,0.0,0,0.0);
- ApplyAnimation(playerid,"SWORD","sword_block",50.0,0,1,1,1,1);
- SetTimerEx("TAnim", 500, 0, "i", playerid);
- HasShield[playerid] = 1;
- SendClientMessage(playerid,RED,"You are now using a Shield.");
- return 1;
- }
- case 1://True (They had a Shield before using CMD:shield)
- {
- DestroyObject(ShieldObject[playerid]);
- ClearAnimations(playerid);
- HasShield[playerid] = 0;
- SendClientMessage(playerid,RED,"You no longer are using a Shield.");
- return 1;
- }
- }
- }
- else
- {
- SendClientMessage(playerid, 0xFF0000FF, "You need to be a Team Member to use a Shield.");
- return 1;
- }
- return 1;
- }
- //-----------------------------------------------------------------------------------------------------------
- //-----------------------------------------------------------------------------------------------------------
- //-----------------------------------------------------------------------------------------------------------
- //-----------------------------------------------------------------------------------------------------------
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- new string[256];
- if(dialogid == 1001)
- {
- if(response)
- {
- switch(listitem)
- {
- case 0:
- {
- if(PGang[playerid] == 0 && GetPlayerScore(playerid) >= 0 )
- {
- ShowPlayerDialog(playerid, 2001, DIALOG_STYLE_INPUT, "{FF0000}[Equipo]{FFFFFF} - Crear equipo", "Ingrese el título en la barra:", "Aceptar", "Cancelar");
- }else return SendClientMessage(playerid, 0xFF0000FF, "Para poder crear tú equipo es necesario tener la cuenta rcon");
- }
- case 1:
- {
- if(PGang[playerid] != 0 && GangLvl[playerid] == 6)
- {
- ShowPlayerDialog(playerid, 1005, DIALOG_STYLE_LIST, "{FF0000}[Equipo]{FFFFFF} - Gang Menu", "Editar id de skin por rango\nColoca el spawn para tú equipo\nAsignar rango\nKick miembro equipo\nCambiar color de equipo\nCambia el nombre de tú equipo\nEliminar clan", "Aceptar", "Cancelar");
- }else return SendClientMessage(playerid, 0xFF0000FF, "No perteneces a ningun equipo.");
- }
- case 2:
- {
- if(PGang[playerid] != 0 && GangLvl[playerid] >= 4)
- {
- ShowPlayerDialog(playerid, 3001, DIALOG_STYLE_INPUT, "{FF0000}[Equipo]{FFFFFF} - Gang Invite", "Agrega una id para enviar la invitación:", "Aceptar", "Cancelar");
- }else return SendClientMessage(playerid, 0xFF0000FF, "No perteneces a ningun equipo, Para invitar a un jugador es necesario tener rango nivel 4.");
- }
- case 3:
- {
- if(PGang[playerid] > 0)
- {
- ShowPlayerDialog(playerid, 6001, DIALOG_STYLE_MSGBOX, "{FF0000}[Equipo]{FFFFFF} - Gang Exit", "Estás seguro de salir de tú equipo?", "Si", "No");
- }else return SendClientMessage(playerid, 0xFF0000FF, "Abandonaste tú equipo!");
- }
- }
- }
- }
- else if(dialogid == 1005)
- {
- if(response)
- {
- switch(listitem)
- {
- case 0:
- {
- if(PGang[playerid] != 0 && GangLvl[playerid] == 6)
- {
- ShowPlayerDialog(playerid, 8001, DIALOG_STYLE_LIST, "{FF0000}[Equipo]{FFFFFF} - Equipo Skin", "Nivel 1\nNivel 2\nNivel 3\nNivel 4\nNivel 5\nNivel 6", "Aceptar", "Cancelar");
- }else return SendClientMessage(playerid, 0xFF0000FF, "Para cambiar el skin de tú equipo necesitas ser nivel 6 .");
- }
- case 1:
- {
- if(PGang[playerid] != 0 && GangLvl[playerid] == 6)
- {
- ShowPlayerDialog(playerid, 7001, DIALOG_STYLE_MSGBOX, "{FF0000}[Equipo]{FFFFFF} - Equipo Spawn", "(Acepta) - para colocar tú nueva posición spawn?", "Aceptar", "Cancelar");
- }else return SendClientMessage(playerid, 0xFF0000FF, "Para cambiar el spawn del equipo necesitas ser nivel 6.");
- }
- case 2:
- {
- if(PGang[playerid] != 0 && GangLvl[playerid] == 6)
- {
- ShowPlayerDialog(playerid, 9001, DIALOG_STYLE_INPUT, "{FF0000}[Equipo]{FFFFFF} - Equipo Rango", "Coloca la id del jugador:", "Aceptar", "Cancelar");
- }else return SendClientMessage(playerid, 0xFF0000FF, "Para cambiar el rango necesitas tener nivel 6.");
- }
- case 3:
- {
- if(PGang[playerid] != 0 && GangLvl[playerid] >= 5)
- {
- ShowPlayerDialog(playerid, 4001, DIALOG_STYLE_INPUT, "{FF0000}[Equipo]{FFFFFF} - Equipo Kick", "Coloca la id del jugador para kickearlo:", "Aceptar", "Cancelar");
- }else return SendClientMessage(playerid, 0xFF0000FF, "Para kickear a un jugador es necesario tener rango nivel 5.");
- }
- case 4:
- {
- if(PGang[playerid] != 0 && GangLvl[playerid] == 6)
- {
- ShowPlayerDialog(playerid, 5001, DIALOG_STYLE_INPUT, "{FF0000}[Equipo]{FFFFFF} - Color de equipo", "Son 6 digitos para asignar un color a su equipo RRGGBB:", "Aceptar", "Cancelar");
- }else return SendClientMessage(playerid, 0xFF0000FF, "Para cambiar el color de tu equipo necesitas terne nivel 6");
- }
- case 5:
- {
- if(PGang[playerid] != 0 && GetPlayerMoney(playerid) >= 5 && GangLvl[playerid] == 6)
- {
- ShowPlayerDialog(playerid, 10010, DIALOG_STYLE_INPUT, "{FF0000}[Equipo]{FFFFFF} Cambio de nombre", "Coloca tú nuevo nombre\naquí abajo:", "Aceptar", "Cancelar");
- }else return SendClientMessage(playerid, 0xFF0000FF, "Para cambiar el nombre de tú equipo necesitas esta cantidad de dinero 5$");
- }
- case 6:
- {
- if(PGang[playerid] != 0 && GangLvl[playerid] == 6)
- {
- ShowPlayerDialog(playerid, 7041, DIALOG_STYLE_MSGBOX, "{FF0000}[Equipo]{FFFFFF} - Gang Delete", "Estás seguro de eliminar tú equipo?", "Sí", "No");
- }else return SendClientMessage(playerid, 0xFF0000FF, "Para eliminar tu equipo necesitas tener nivel 6.");
- }
- }
- }
- }
- else if(dialogid == 2001)
- {
- if(response)
- {
- if(!strlen(inputtext)) return ShowPlayerDialog(playerid, 2001, DIALOG_STYLE_INPUT, "{FF0000}[Equipo]{FFFFFF} - Crear equipo", "Ingrese un nombre:", "Aceptar", "Cancelar");
- format(GangName[playerid], 256, inputtext);
- ShowPlayerDialog(playerid, 2002, DIALOG_STYLE_INPUT, "{FF0000}[Equipo]{FFFFFF} - Crear equipo", "Ingrese un color para su equipo:", "Aceptar", "Cancelar");
- }
- }
- else if(dialogid == 2002)
- {
- if(response)
- {
- if(!strlen(inputtext)) return ShowPlayerDialog(playerid, 2002, DIALOG_STYLE_INPUT, "{FF0000}[Equipo]{FFFFFF} - Crear equipo", "Ingrese un color para su equipo:", "Aceptar", "Cancelar");
- if(strlen(inputtext) != 6)
- {
- SendClientMessage(playerid, 0xFF0000, "Son 6 digitos para asignar un color a su equipo RRGGBB!");
- return ShowPlayerDialog(playerid, 2002, DIALOG_STYLE_INPUT, "{FF0000}[Equipo]{FFFFFF} - Crear equipo", "Ingrese un color para su equipo:", "Aceptar", "Cancelar");
- }
- new f[256],year,month,day,lolo[128]; getdate(year, month, day);
- format(f, 256, "Gangs/%i.ini",GetFreeGang());
- new cfile = ini_createFile(f);
- if(cfile == INI_OK)
- {
- GangLvl[playerid] = 6;
- PGang[playerid] = GetFreeGang();
- format(GName[PGang[playerid]], 256, GangName[playerid]);
- format(GColor[PGang[playerid]], 10, "%s00", inputtext);
- format(lolo, sizeof(lolo),"%d/%d/%d",day, month, year);
- new hex[MAX_PLAYERS];
- hex[playerid] = HexToInt(GColor[PGang[playerid]]);
- SetPlayerColor(playerid, hex[playerid]);
- Gang[GetFreeGang()] = 1;
- //GivePlayerMoney(playerid, -1000000);
- format(string, sizeof(string), "{FFFF00}La primera etapa de construcción!\r\n{FFFF00}Su equipo es: %s\r\n{FFFF00}Color asignado: {%s}%s\r\n{FFFF00}Fecha de creación: {FFFFFF}%s", GName[PGang[playerid]], inputtext,GColor[PGang[playerid]],lolo);
- ShowPlayerDialog(playerid, 1002, DIALOG_STYLE_MSGBOX, "{FF0000}[Equipo]{FFFFFF} - Crear equipo", string, "Aceptar", "Cancelar");
- ini_setString(cfile, "Gang name", GName[PGang[playerid]]);
- ini_setString(cfile, "Gang color", GColor[PGang[playerid]]);
- ini_setString(cfile, "founded", lolo);
- ini_setFloat(cfile, "SpawnX", 0.0);
- ini_setFloat(cfile, "SpawnY", 0.0);
- ini_setFloat(cfile, "SpawnZ", 0.0);
- ini_setInteger(cfile, "Skin1", 0);
- ini_setInteger(cfile, "Skin2", 0);
- ini_setInteger(cfile, "Skin2", 0);
- ini_setInteger(cfile, "Skin3", 0);
- ini_setInteger(cfile, "Skin4", 0);
- ini_setInteger(cfile, "Skin5", 0);
- ini_setInteger(cfile, "Skin6", 0);
- ini_closeFile(cfile);
- }
- }
- }
- else if(dialogid == 3001)
- {
- if(response)
- {
- if(!strlen(inputtext)) return ShowPlayerDialog(playerid, 3001, DIALOG_STYLE_INPUT, "{FF0000}[Equipo]{FFFFFF} - Gang Invite", "Ingrese la identificación del jugador, que desea agregar:", "Aceptar", "Cancelar");
- if(IsPlayerConnected(strval(inputtext)))
- {
- if(PGang[strval(inputtext)] == 0)
- {
- format(string, sizeof(string), "%s te invito a unirte al clan '%s'", PlayerName(playerid), GName[PGang[playerid]]);
- ShowPlayerDialog(strval(inputtext), 3002, DIALOG_STYLE_MSGBOX, "Te acaban de invitar a unirte a un equipo", string, "Aceptar", "Cancelar");
- format(string, sizeof(string), "'%s' enviaste una invitación de equipo", PlayerName(playerid), PlayerName(id[playerid]));
- for(new i; i<MAX_PLAYERS; i++)
- {
- if(PGang[i] == PGang[playerid])
- {
- SendClientMessage(i, 0xFF0000FF, string);
- }
- }
- tgang[strval(inputtext)] = PGang[playerid];
- }else return SendClientMessage(playerid, 0xFFFFFFFF, "Enviaste invitacion!");
- }else return SendClientMessage(playerid, 0xFFFFFFFF, "Este jugador no esta conectado!");
- }
- }
- else if(dialogid == 3002)
- {
- if(response)
- {
- PGang[playerid] = tgang[playerid];
- GangLvl[playerid] = 1;
- new hex[MAX_PLAYERS];
- hex[playerid] = HexToInt(GColor[PGang[playerid]]);
- SetPlayerColor(playerid, hex[playerid]);
- format(string, sizeof(string), "Te acabas de unir al equipo '%s'", GName[PGang[playerid]]);
- SendClientMessage(playerid, 0xFFFFFFFF, string);
- format(string, sizeof(string), "%s bienvenido a tú nuevo equipo!", PlayerName(playerid));
- for(new i; i<MAX_PLAYERS; i++)
- {
- if(PGang[i] == PGang[playerid])
- {
- SendClientMessage(i, 0xFFFF00FF, string);
- }
- }
- }
- else
- {
- tgang[playerid] = 0;
- }
- }
- else if(dialogid == 4001)
- {
- if(response)
- {
- if(!strlen(inputtext)) return ShowPlayerDialog(playerid, 4001, DIALOG_STYLE_INPUT, "{FF0000}[Equipo]{FFFFFF} - Gang Kick", "Coloca la id del jugador para kickearlo:", "Aceptar", "Cancelar");
- if(IsPlayerConnected(strval(inputtext)))
- {
- if(PGang[strval(inputtext)] == PGang[playerid])
- {
- PGang[strval(inputtext)] = 0;
- GangLvl[strval(inputtext)] = 0;
- format(string, 256, "{FF0000}Has expulsado a este jugador >'{FFFFFF}%s{FF0000}'", PlayerName(playerid));
- SpawnPlayer(playerid);
- SendClientMessage(playerid, 0xFF0000FF, string);
- }else return SendClientMessage(playerid, 0xFFFFFFFF, "Ýòîò èãðîê íå â âàøåé áàíäå!");
- }else return SendClientMessage(playerid, 0xFFFFFFFF, "Jugador no conectado!");
- }
- }
- else if(dialogid == 5001)
- {
- if(response)
- {
- if(!strlen(inputtext)) return ShowPlayerDialog(playerid, 5001, DIALOG_STYLE_INPUT, "{FF0000}[Equipo]{FFFFFF} - Color de equipo", "Son 6 digitos para asignar un color a su equipo RRGGBB:", "Aceptar", "Cancelar");
- if(strlen(inputtext) != 6)
- {
- SendClientMessage(playerid, 0xFF0000FF, "Son 6 digitos para asignar un color a su equipo RRGGBB!");
- return ShowPlayerDialog(playerid, 5001, DIALOG_STYLE_INPUT, "Cambiar color del equipo", "Son 6 digitos para asignar un color a su equipo RRGGBB:", "Aceptar", "Cancelar");
- }
- format(GColor[PGang[playerid]], 10, "%s00", inputtext);
- new hex[MAX_PLAYERS];
- hex[playerid] = HexToInt(GColor[PGang[playerid]]);
- SetPlayerColor(playerid,hex[playerid]);
- format(string, sizeof(string), "Cambiaste el color de tú equipo: {%s}%s", inputtext, GColor[PGang[playerid]]);
- SendClientMessage(playerid, 0xCCFF00FF, string);
- new f[256];
- format(f, 256, "Gangs/%i.ini",PGang[playerid]);
- new file = ini_openFile(f);
- if(file == INI_OK)
- {
- ini_setString(file, "Gang color", GColor[PGang[playerid]]);
- ini_closeFile(file);
- }
- }
- }
- else if(dialogid == 6001)
- {
- if(response)
- {
- format(string,sizeof(string), "{FFFF00}'{FFFFFF}%s{FFFF00}'salio del equipo!", PlayerName(playerid));
- SpawnPlayer(playerid);
- SendClientMessage(playerid, 0xFFFF00AA, "Acabas de abandonar tú equipo");
- for(new i; i<MAX_PLAYERS; i++)
- {
- if(PGang[i] == PGang[playerid] && i != playerid)
- {
- SendClientMessage(i, 0xFFFF00FF, string);
- }
- }
- PGang[playerid] = 0;
- GangLvl[playerid] = 0;
- }
- }
- else if(dialogid == 7001)
- {
- if(response)
- {
- new Float:x, Float:y, Float:z;
- GetPlayerPos(playerid, x, y, z);
- GSpawnX[PGang[playerid]] = x;
- GSpawnY[PGang[playerid]] = y;
- GSpawnZ[PGang[playerid]] = z;
- // Later..
- new f[256];
- format(f, 256, "Gangs/%i.ini",PGang[playerid]);
- new file = ini_openFile(f);
- if(file == INI_OK)
- {
- ini_setFloat(file, "SpawnX", x);
- ini_setFloat(file, "SpawnY", y);
- ini_setFloat(file, "SpawnZ", z);
- ini_closeFile(file);
- }
- }
- }
- else if(dialogid == 8001)
- {
- if(response)
- {
- switch(listitem)
- {
- case 0: gangskin[playerid] = 1;
- case 1: gangskin[playerid] = 2;
- case 2: gangskin[playerid] = 3;
- case 3: gangskin[playerid] = 4;
- case 4: gangskin[playerid] = 5;
- case 5: gangskin[playerid] = 6;
- }
- ShowPlayerDialog(playerid, 8002, DIALOG_STYLE_INPUT, "{FF0000}[Equipo]{FFFFFF} - Gang Skin", "Ingrese una ID para su skin:", "Aceptar", "Cancelar");
- }
- }
- else if(dialogid == 8002)
- {
- if(response)
- {
- if(!strlen(inputtext) && strval(inputtext) > 0) return ShowPlayerDialog(playerid, 8002, DIALOG_STYLE_INPUT, "{FF0000}[Equipo]{FFFFFF} - Gang Skin", "Ingrese una buena ID:", "Aceptar", "Cancelar");
- new f[256];
- format(f, 256, "Gangs/%i.ini",PGang[playerid]);
- new file = ini_openFile(f);
- if(file == INI_OK)
- {
- format(string, 256, "Skin%i", gangskin[playerid]);
- ini_setInteger(file, string, strval(inputtext));
- ini_closeFile(file);
- format(string, sizeof(string), "Cambiaste la ID del skin! por: %i", strval(inputtext));
- SendClientMessage(playerid, 0xFFFF00FF, string);
- GSkin[PGang[playerid]][gangskin[playerid]-1] = strval(inputtext);
- for(new i; i<MAX_PLAYERS; i++)
- {
- if(PGang[i] == PGang[playerid] && GangLvl[i] == gangskin[playerid])
- {
- SetPlayerSkin(i, strval(inputtext));
- }
- }
- gangskin[playerid] = 0;
- }
- }
- }
- else if(dialogid == 9001)
- {
- if(response)
- {
- if(!strlen(inputtext)) return ShowPlayerDialog(playerid, 9001, DIALOG_STYLE_INPUT, "{FF0000}[Equipo]{FFFFFF} - Equipo Rango", "Coloca la id del jugador:", "Aceptar", "Cancelar");
- if(PGang[strval(inputtext)] != PGang[playerid])
- {
- SendClientMessage(playerid, 0xFFFF00FF, "Id erronea, verifique bien la id!");
- return ShowPlayerDialog(playerid, 9001, DIALOG_STYLE_INPUT, "{FF0000}[Equipo]{FFFFFF} - Equipo Rango", "Ingrese la identificación de la etiqueta, que desea encontrar:", "Aceptar", "Cancelar");
- }
- id[playerid] = strval(inputtext);
- ShowPlayerDialog(playerid, 9002, DIALOG_STYLE_LIST, "{FF0000}[Equipo]{FFFFFF} - Uniformes del equipo", "(Soldado) Nivel 1\n(Cabo) Nivel 2\n(Sargento) Nivel 3\n(Teniente) Nivel 4\n(Capitán) Nivel 5\n(Mayor General) Nivel 6", "Aceptar", "Cancelar");
- }
- }
- else if(dialogid == 9002)
- {
- if(response)
- {
- switch(listitem)
- {
- case 0: GangLvl[id[playerid]] = 1;
- case 1: GangLvl[id[playerid]] = 2;
- case 2: GangLvl[id[playerid]] = 3;
- case 3: GangLvl[id[playerid]] = 4;
- case 4: GangLvl[id[playerid]] = 5;
- case 5: GangLvl[id[playerid]] = 6;
- }
- format(string, sizeof(string), "Este era tú rango anterior 0", PlayerName(id[playerid]), GangLvl[id[playerid]]);
- SendClientMessage(playerid, 0xFFFF00FF, string);
- format(string, sizeof(string), "Este es el actual rango %s <id> %i", PlayerName(playerid), GangLvl[id[playerid]]);
- SendClientMessage(id[playerid], 0xFFFF00FF, string);
- if(GSkin[PGang[playerid]][GangLvl[id[playerid]]] > 0) SetPlayerSkin(id[playerid], GSkin[PGang[playerid]][GangLvl[id[playerid]]-1]);
- id[playerid] = -1;
- }
- }
- else if(dialogid == 10010)
- {
- if(response)
- {
- if(!strlen(inputtext)) return ShowPlayerDialog(playerid, 10010, DIALOG_STYLE_INPUT, "{FF0000}[Equipo]{FFFFFF} - Cambio de nombre ", "Coloca el nuevo nombre del equipo\naqui abajo:", "Aceptar", "Cancelar");
- format(GName[PGang[playerid]], 256, "%s", inputtext);
- format(string, sizeof(string), "\n{FFFF00}Has cambiado el nombre del equipo ahora es: {FF0000}%s\n",inputtext);
- ShowPlayerDialog(playerid, 10011, DIALOG_STYLE_MSGBOX, "{FF0000}[Equipo]{FFFFFF} - Clan de nombre de Equipo", string, "Ok", "");
- new f[256];
- format(f, 256, "Gangs/%i.ini",PGang[playerid]);
- new file = ini_openFile(f);
- if(file == INI_OK)
- {
- ini_setString(file, "Gang name", GName[PGang[playerid]]);
- ini_closeFile(file);
- }
- }
- }
- else if(dialogid == 7041)
- {
- if(response)
- {
- new f[256];
- format(f, 256, "Gangs/%i.ini",PGang[playerid]);
- fremove(f);
- PGang[playerid] = 0;
- GangLvl[playerid] = 0;
- SendClientMessage(playerid, 0xFFFF00FF, "Eliminaste tú equipo!");
- }
- }
- //----------------------------------------------------------------------------
- if ( response )
- {
- switch ( dialogid )
- {
- case 10 :
- {
- switch ( listitem )
- {
- case 0 : ShowPlayerDialog( playerid, 11, DIALOG_STYLE_LIST, "Aviones", "Andromada\nBeagle\nCropduster\nDodo\nNevada\nRustler\nShamal\nStuntplane\nAtras", "Aceptar", "Cancelar" );
- case 1 : ShowPlayerDialog( playerid, 12, DIALOG_STYLE_LIST, "Helicopteros", "Cargobob\nLeviathan\nMaverick\nMaverick SATV\nMaverick De Policia\nRaindance\nSparrow\nAtras", "Aceptar", "Cancelar" );
- case 2 : ShowPlayerDialog( playerid, 13, DIALOG_STYLE_LIST, "Moto o cuatriciclo", "Quad\nSanchez\nMoto Policia\nAtras", "Aceptar", "Cancelar" );
- case 3 : ShowPlayerDialog( playerid, 14, DIALOG_STYLE_LIST, "Todoterreno", "Patriot\nRancher A\nRancher B\nSandking\nAtras", "Aceptar", "Cancelar" );
- case 4 : ShowPlayerDialog( playerid, 15, DIALOG_STYLE_LIST, "Servicio Publico", "Ambulancia\nBarracks\nBus\nCoach\nEnforcer\nFBI Rancher\nFBI Truck\nFiretruck\nFiretruck LA\nPatrulla (LSPD)\nPatrulla (LVPD)\nPatrulla (SFPD)\nRanger\nRhino\nS.W.A.T\nAtras", "Aceptar", "Cancelar" );
- case 5 : ShowPlayerDialog( playerid, 16, DIALOG_STYLE_LIST, "Barcos", "Guardia Costera\nDinghy\nJetmax\nLaunch\nMarquis\nPredator\nReefer\nSpeeder\nSqualo\nTropic\nAtras", "Aceptar", "Cancelar" );
- }
- }
- case 11 :
- {
- if ( listitem > 10 ) return ShowPlayerDefaultDialog( playerid );
- new
- modelo[] = { 592, 511, 512, 593, 553, 476, 519, 513 };
- return VehicleSpawner( playerid, modelo[ listitem ] );
- }
- case 12 :
- {
- if ( listitem > 6 ) return ShowPlayerDefaultDialog( playerid );
- new
- modelo[] = { 548, 417, 487, 488, 497, 563, 469 };
- return VehicleSpawner( playerid, modelo[ listitem ] );
- }
- case 13 :
- {
- if ( listitem > 2 ) return ShowPlayerDefaultDialog( playerid );
- new
- modelo[] = { 471, 468, 523};
- return VehicleSpawner( playerid, modelo[ listitem ] );
- }
- case 14 :
- {
- if ( listitem > 3 ) return ShowPlayerDefaultDialog( playerid );
- new
- modelo[] = { 470, 489, 505, 495 };
- return VehicleSpawner( playerid, modelo[ listitem ] );
- }
- case 15 :
- {
- if ( listitem > 14 ) return ShowPlayerDefaultDialog( playerid );
- new
- modelo[] = { 416, 433, 431, 437, 427, 490, 528, 407, 544, 596, 598, 597, 599, 432, 601};
- return VehicleSpawner( playerid, modelo[ listitem ] );
- }
- case 16 :
- {
- if ( listitem > 9 ) return ShowPlayerDefaultDialog( playerid );
- new
- modelo[] = { 472, 473, 493, 595, 484, 430, 453, 452, 446, 454 };
- return VehicleSpawner( playerid, modelo[ listitem ] );
- }
- }
- }
- return 0;
- }
- GetFreeGang()
- {
- for(new i=1; i<MAX_GANGS; i++)
- {
- if(Gang[i] == 0) return i;
- }
- return false;
- }
- forward LoadAccount(playerid);
- public LoadAccount(playerid)
- {
- new f[256], hex[MAX_PLAYERS];
- format(f, 256, "Gangs/Players/%s.ini", PlayerName(playerid));
- new file = ini_openFile(f);
- if(file == INI_OK)
- {
- ini_getInteger(file, "Gang", PGang[playerid]);
- ini_getInteger(file, "GangLvl", GangLvl[playerid]);
- if(PGang[playerid] > 0)
- {
- hex[playerid] = HexToInt(GColor[PGang[playerid]]);
- SetPlayerColor(playerid, hex[playerid]);
- }
- ini_closeFile(file);
- return true;
- }
- else
- {
- ini_closeFile(file);
- file = ini_createFile(f);
- ini_setInteger(file, "Gang", 0);
- ini_setInteger(file, "GangLvl", 0);
- ini_closeFile(file);
- return true;
- }
- }
- forward SaveAccount(playerid);
- public SaveAccount(playerid)
- {
- new f[256];
- format(f, 256, "Gangs/Players/%s.ini", PlayerName(playerid));
- new file = ini_openFile(f);
- if(file == INI_OK)
- {
- ini_setInteger(file, "Gang", PGang[playerid]);
- ini_setInteger(file, "GangLvl", GangLvl[playerid]);
- ini_closeFile(file);
- }
- return true;
- }
- public OnPlayerConnect(playerid)
- {
- playertarget[playerid] = Create3DTextLabel(" ", 0xFFFFFFFF, 10.0, 40.0, 50.0, 10.0, 0, 1);//Sistema de nombre//
- Attach3DTextLabelToPlayer(playertarget[playerid], playerid, 0.0, 0.0, 0.0);//Sistema de nombre//
- AccInfo[playerid][pVehicle] = -1;
- new file, f[256];
- for(new i; i<MAX_GANGS; i++)
- {
- format(f, 256, "Gangs/%i.ini",i);
- file = ini_openFile(f);
- if(file == INI_OK)
- {
- ini_getString(file, "Gang name", inigangname[i]);
- format(GName[i], 256, inigangname[i]);
- ini_getString(file, "Gang color", col[i]);
- format(GColor[i], 10, col[i]);
- ini_getFloat(file, "SpawnX", GSpawnX[i]);
- ini_getFloat(file, "SpawnY", GSpawnY[i]);
- ini_getFloat(file, "SpawnZ", GSpawnZ[i]);
- ini_getInteger(file, "Skin1", GSkin[i][0]);
- ini_getInteger(file, "Skin2", GSkin[i][1]);
- ini_getInteger(file, "Skin3", GSkin[i][2]);
- ini_getInteger(file, "Skin4", GSkin[i][3]);
- ini_getInteger(file, "Skin5", GSkin[i][4]);
- ini_getInteger(file, "Skin6", GSkin[i][5]);
- CreatePickup(1314, 1, GSpawnX[i],GSpawnY[i],GSpawnZ[i], -1);
- Gang[i] = 1;
- ini_closeFile(file);
- }
- }
- return 1;
- }
- forward GangLoad();
- public GangLoad()
- {
- new file, f[256];
- for(new i; i<MAX_GANGS; i++)
- {
- format(f, 256, "Gangs/%i.ini",i);
- file = ini_openFile(f);
- if(file == INI_OK)
- {
- ini_getString(file, "Gang name", inigangname[i]);
- format(GName[i], 256, inigangname[i]);
- ini_getString(file, "Gang color", col[i]);
- format(GColor[i], 10, col[i]);
- ini_getFloat(file, "SpawnX", GSpawnX[i]);
- ini_getFloat(file, "SpawnY", GSpawnY[i]);
- ini_getFloat(file, "SpawnZ", GSpawnZ[i]);
- ini_getInteger(file, "Skin1", GSkin[i][0]);
- ini_getInteger(file, "Skin2", GSkin[i][1]);
- ini_getInteger(file, "Skin3", GSkin[i][2]);
- ini_getInteger(file, "Skin4", GSkin[i][3]);
- ini_getInteger(file, "Skin5", GSkin[i][4]);
- ini_getInteger(file, "Skin6", GSkin[i][5]);
- Gang[i] = 1;
- ini_closeFile(file);
- }
- }
- return false;
- }
- forward Spawn(playerid);
- public Spawn(playerid)
- {
- if(GSkin[PGang[playerid]][GangLvl[playerid]-1] > 0)
- {
- SetPlayerSkin(playerid, GSkin[PGang[playerid]][GangLvl[playerid]-1]);
- }
- if(GSpawnX[PGang[playerid]] != 0.0 && GSpawnY[PGang[playerid]] != 0.0 && GSpawnZ[PGang[playerid]] != 0.0)
- {
- SetPlayerPos(playerid, GSpawnX[PGang[playerid]], GSpawnY[PGang[playerid]], GSpawnZ[PGang[playerid]]);
- }
- new hex[MAX_PLAYERS];
- hex[playerid] = HexToInt(GColor[PGang[playerid]]);
- SetPlayerColor(playerid, hex[playerid]);
- }
- PlayerName(playerid)
- {
- new pname[MAX_PLAYER_NAME];
- GetPlayerName(playerid,pname,sizeof(pname));
- return pname;
- }
- HexToInt(string[])
- {
- if (string[0]==0) return 0;
- new i, cur=1,res=0;
- for (i=strlen(string);i>0;i--)
- {
- if (string[i-1]<58){res=res+cur*(string[i-1]-48);}
- else res=res+cur*(string[i-1]-65+10);
- cur=cur*16;
- }
- return res;
- }
- //=============================================NUEVA FUNCION===============================================
- public VehicleSpawner(playerid,model)
- {
- if(IsPlayerInAnyVehicle(playerid))
- SendClientMessage(playerid, RED, "ERROR: Ya Estas En Un Auto!");
- else
- {
- new Float:x, Float:y, Float:z, Float:angle;
- GetPlayerPos(playerid, x, y, z);
- GetPlayerFacingAngle(playerid, angle);
- if(AccInfo[playerid][pVehicle] != -1)
- DeleteVehicle(AccInfo[playerid][pVehicle]);
- new vehicleid=CreateVehicle(model, x, y, z+2, angle, -1, -1, -1);
- PutPlayerInVehicle(playerid, vehicleid, 0);
- SetVehicleVirtualWorld(vehicleid, GetPlayerVirtualWorld(playerid));
- LinkVehicleToInterior(vehicleid, GetPlayerInterior(playerid));
- AccInfo[playerid][pVehicle] = vehicleid;
- }
- return 1;
- }
- public DeleteVehicle(vehicleid)
- {
- for(new i=0;i<MAX_PLAYERS;i++)
- {
- new Float:X,Float:Y,Float:Z;
- if(IsPlayerInVehicle(i, vehicleid))
- {
- RemovePlayerFromVehicle(i);
- GetPlayerPos(i,X,Y,Z);
- SetPlayerPos(i,X,Y+3,Z);
- }
- SetVehicleParamsForPlayer(vehicleid,i,0,1);
- }
- SetTimerEx("RespawnVehicle",1500,0,"i",vehicleid);
- }
- public RespawnVehicle(vehicleid)
- {
- DestroyVehicle(vehicleid);
- }
- public OnVehicleSpawn(vehicleid)
- {
- for(new i=0;i<MAX_PLAYERS;i++)
- {
- if(vehicleid==AccInfo[i][pVehicle])
- {
- DeleteVehicle(vehicleid);
- AccInfo[i][pVehicle]=-1;
- }
- }
- return 1;
- }
- //Sistema de nombre//
- public OnPlayerUpdate(playerid)
- {
- static text[256], Nplayer[MAX_PLAYER_NAME];
- GetPlayerName(playerid, Nplayer, MAX_PLAYER_NAME);
- format(text,sizeof(text),"{%06x}%s {285E91}[%s]{FFFFFF}[%d]\n%s\n%s", GetPlayerColor(playerid) >>> 8, Nplayer, GName[PGang[playerid]],playerid);
- Update3DTextLabelText(playertarget[playerid], 0xFFFFFFFF, text);
- return 1;
- }
Add Comment
Please, Sign In to add comment