Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define MAX_ORGS 100
- #define PASTA_ORGS "Orgs/Org%d.ini"
- enum InfoOrg {
- Cofre,
- Pickup,
- pLider[24],
- Text3D:pLabel
- }
- new Organizacao[MAX_ORGS][InfoOrg];
- main()
- {
- printf("\nSistema De Organizaçãoes Carregado");
- }
- public OnGameModeInit()
- {
- for(new i = 0; i < MAX_ORGS; i++)
- {
- new file[155], string[155];
- format(file, sizeof(file), PASTA_ORGS, i);
- Organizacao[i][Pickup] = CreatePickup(DOF2_GetInt(file, "Pickup"), 0 , DOF2_GetFloat(file, "PosX"), DOF2_GetFloat(file, "PosY"), DOF2_GetFloat(file, "PosZ"), 0);
- if(DOF2_FileExists(file))
- {
- format(string, sizeof(string),"{181b18}Organizacao [ {181b18}ID: {595959}%d {181b18}\n{181b18}Nome: {367d36}%s\n{181b18}Lider: {367d36}%s\n{181b18}Cofre: {367d36}%d", i, DOF2_GetString(file, "Nome"), DOF2_GetString(file, "Lider"), DOF2_GetInt(file, "Cofre"));
- Organizacao[i][pLabel] = Create3DTextLabel(string, -1, DOF2_GetFloat(file, "PosX"), DOF2_GetFloat(file, "PosY"), DOF2_GetFloat(file, "PosZ"), 40.0, 0,0);
- Organizacao[i][Cofre] = DOF2_GetInt(file, "Cofre");
- }
- }
- return 1;
- }
- public OnGameModeExit()
- {
- DOF2_Exit();
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- new file[155], aname[MAX_PLAYER_NAME];
- GetPlayerName(playerid, aname, sizeof(aname));
- for(new i = 0; i < MAX_ORGS; i++)
- {
- format(file, sizeof(file), PASTA_ORGS, i);
- if(strcmp(aname, DOF2_GetString(file, "Lider"), true) == 0)
- {
- Organizacao[i][pLider] = aname;
- }
- }
- 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)
- {
- 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[])
- {
- return 1;
- }
- public OnPlayerClickPlayer(playerid, clickedplayerid, source)
- {
- return 1;
- }
- CMD:org(playerid, params[])
- {
- new funcao[24], aname[MAX_PLAYER_NAME], file[155], string[144], string2[144];
- if(sscanf(params, "s[24]", funcao)) return SendClientMessage(playerid, -1, "[ ERRO ] {FF0000}Use: /org [lider]");
- GetPlayerName(playerid, aname, sizeof(aname));
- if(strfind(funcao, "lider", true) != -1)
- {
- for(new i = 0; i < MAX_ORGS; i++)
- {
- format(file, sizeof(file), PASTA_ORGS, i);
- if(DOF2_FileExists(file))
- {
- if(IsPlayerInRangeOfPoint(playerid, 4.0, DOF2_GetFloat(file, "PosX"), DOF2_GetFloat(file, "PosY"), DOF2_GetFloat(file, "PosZ")))
- {
- if(strcmp(DOF2_GetString(file, "Lider"), "Ninguem", true) == 0)
- {
- DOF2_SetString(file, "Lider", aname);
- format(string, sizeof(string), "[ORG] %s parab¨¦ns voc¨º se tornou o lider da organiza??o %s", aname, DOF2_GetString(file, "Nome"));
- SendClientMessage(playerid, 0x00FF80AA, string);
- DOF2_SaveFile();
- return 1;
- }
- }
- }
- }
- }
- else if(strfind(funcao, "info", true) != -1)
- {
- for(new i = 0; i < MAX_ORGS; i++)
- {
- format(file, sizeof(file), PASTA_ORGS, i);
- if(DOF2_FileExists(file))
- {
- if(IsPlayerInRangeOfPoint(playerid, 4.0, DOF2_GetFloat(file, "PosX"), DOF2_GetFloat(file, "PosY"), DOF2_GetFloat(file, "PosZ")))
- {
- format(string, sizeof(string), "Org %s - Informacoes", DOF2_GetString(file, "Nome"));
- format(string2, sizeof(string2), "Organiza??o %s\n\n{FF0000}Lider: {FFFFFF}%s\n1 - Membro: %s\n2 - Membro: %s\n3 - Membro: %s\n4 - Membro: %s\n5 - Membro: %s", DOF2_GetString(file, "Nome"));
- ShowPlayerDialog(playerid, DIALOG_ORGINFO, DIALOG_STYLE_MSGBOX, string, "", "Fechar", "");
- }
- }
- }
- }
- return 1;
- }
- CMD:criarorg(playerid, params[])
- {
- new aname[MAX_PLAYER_NAME], nome[60], dinheiro, file[155], string[155], Float:Pos[3];
- GetPlayerName(playerid, aname, sizeof(aname));
- if(sscanf(params, "s[60]d", nome, dinheiro)) return SendClientMessage(playerid, -1, "[ ERRO ] {FF0000}use: /criarorg [nome] [dinheiro]");
- for(new i = 0; i < MAX_ORGS; i++)
- {
- format(file, sizeof(file), PASTA_ORGS, i);
- if(DOF2_FileExists(file) && strcmp( DOF2_GetString(file, "Nome"), nome, true ) == 0 )
- {
- SendClientMessage(playerid, -1, "[ ERRO ] {FF0000}J¨¢ existe uma organizacao com este nome!");
- return 1;
- }
- else
- {
- if(!DOF2_FileExists(file))
- {
- GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
- DOF2_CreateFile(file);
- DOF2_SetString(file, "Nome", nome);
- DOF2_SetInt(file, "Cofre", dinheiro);
- DOF2_SetFloat(file, "PosX", Pos[0]);
- DOF2_SetFloat(file, "PosY", Pos[1]);
- DOF2_SetFloat(file, "PosZ", Pos[2]);
- DOF2_SetInt(file, "Pickup", 1318);
- DOF2_SetString(file, "Lider", "Ninguem");
- DOF2_SetString(file, "Membro1", "Ninguem");
- DOF2_SetString(file, "Membro2", "Ninguem");
- DOF2_SetString(file, "Membro3", "Ninguem");
- DOF2_SetString(file, "Membro4", "Ninguem");
- DOF2_SetString(file, "Membro5", "Ninguem");
- DOF2_SaveFile();
- Organizacao[i][Pickup] = CreatePickup(1318, 0 , Pos[0], Pos[1], Pos[2], 0);
- format(string, sizeof(string),"{FF0000}Organizacao [ {FFFFFF}ID: {FF0000}%d {FFFFFF}]\n{FF0000}Nome: {FFFFFF}%s\n{FF0000}Lider: %s\n{FF0000}Cofre: {FFFFFF}%d", i, DOF2_GetString(file, "Nome"), DOF2_GetString(file, "Lider"), DOF2_GetInt(file, "Cofre"));
- Organizacao[i][pLabel] = Create3DTextLabel(string, -1, Pos[0], Pos[1], Pos[2], 40.0, 0,0);
- Organizacao[i][Cofre] = dinheiro;
- format(string, sizeof(string), "[ INFO ] Organizacao %s [ ID: %d ] criada com sucesso!", nome, i);
- SendClientMessage(playerid, 0x00FF80AA, string);
- return 1;
- }
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement