Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Sistema de trabajos By Badyx
- Fecha: 05/10/2012
- Tiempo: 1 hora
- 3 trabajos
- Repartidor periodicos
- Repartidor de mensajeria
- Pescador
- Para www.Pawnoscripting.com
- Caracteristicas V.2.0
- Ahora se podra mover las posiciones de los trabajos donde se desee
- */
- #include <a_samp>
- #include <streamer>
- #define funcion%0(%1) \
- forward %0(%1); \
- public %0(%1)
- #define Rojo 0xa80707FF
- #define Verde 0x1eb032FF
- #define PICKUP_RANGE 50
- #define MAX_S_PICKUPS 400
- enum pickupINFO
- {
- pickupCreated,
- pickupVisible,
- pickupID,
- pickupRange,
- Float:pickupX,
- Float:pickupY,
- Float:pickupZ,
- pickupType,
- pickupModel
- }
- new Pickup[MAX_S_PICKUPS+1][pickupINFO];
- enum PosicionRP
- {
- Float:X,
- Float:Y,
- Float:Z,
- World,
- Interior,
- Float:Angle,
- PickupID,
- };
- new RepartidorPeriodicos[PosicionRP];
- enum PosicionRepartidor
- {
- Float:X,
- Float:Y,
- Float:Z,
- World,
- Interior,
- Float:Angle,
- PickupID,
- };
- new Repartidor[PosicionRepartidor];
- new Float:PuntosRPeriodicos[3][3] = {
- {910.0433,-1795.7535,13.5547},
- {923.4427,-1797.1438,13.5469},
- {934.5285,-1798.4348,13.7699}
- };
- new Float:PuntosRepartidor[2][3] = {
- {1682.2114,-1635.0190,13.6392},
- {1804.1008,-2118.6482,13.5543}
- };
- new bool:RepartiendoPeriodicos[MAX_PLAYERS];
- new bool:RepartiendoCajas[MAX_PLAYERS];
- new bool:EstaPescando[MAX_PLAYERS];
- funcion OnFilterScriptInit()
- {
- CargarPosJobRPeriodicos();
- CargarPosJobRepartidor();
- SetTimer("MostrarInformacion", 1000, 1);
- return 1;
- }
- #if defined FILTERSCRIPT
- #else
- main(){}
- #endif
- funcion OnPlayerConnect(playerid)
- {
- RepartiendoPeriodicos[playerid] = false;
- RepartiendoCajas[playerid] = false;
- EstaPescando[playerid] = false;
- return 1;
- }
- funcion OnPlayerDisconnect(playerid, reason)
- {
- RepartiendoPeriodicos[playerid] = false;
- RepartiendoCajas[playerid] = false;
- EstaPescando[playerid] = false;
- return 1;
- }
- funcion OnPlayerCommandText(playerid, cmdtext[])
- {
- /* Repartidor de periodicos */
- if (strcmp("/RepartirPeriodicos", cmdtext, true, 10) == 0)
- {
- if (RepartiendoPeriodicos[playerid] == false)
- {
- if(EsBicicleta(GetPlayerVehicleID(playerid)))
- {
- if(IsPlayerInAnyVehicle(playerid))
- {
- SendClientMessage(playerid,Verde,"Repartiendo periodicos...");
- SendClientMessage(playerid,Verde,"Dirigete a los checkpoints (puntos rojos).");
- RepartiendoPeriodicos[playerid] = true;
- new randomize;
- randomize = random(sizeof(PuntosRPeriodicos));
- SetPlayerCheckpoint(playerid, PuntosRPeriodicos[randomize][0], PuntosRPeriodicos[randomize][1], PuntosRPeriodicos[randomize][2], 5.0);
- return 1;
- }
- return SendClientMessage(playerid,Rojo,"[Error] No estas en un coche!");
- }
- return SendClientMessage(playerid,Rojo,"[Error] Necesita estar en una bicicleta para usar este comando!");
- }
- return SendClientMessage(playerid,Rojo,"[Error] Usted ya esta repartiendo periodicos!");
- }
- if (strcmp("/dRepartirPeriodicos", cmdtext, true, 10) == 0)
- {
- if (RepartiendoPeriodicos[playerid] == true)
- {
- SendClientMessage(playerid,Verde,"Dejaste de repartir periodicos.");
- RepartiendoPeriodicos[playerid] = false;
- DisablePlayerRaceCheckpoint(playerid);
- return 1;
- }
- return SendClientMessage(playerid,Rojo,"[Error] Usted no esta repartiendo periodicos!");
- }
- /* Repartidor */
- if (strcmp("/Repartir", cmdtext, true, 10) == 0)
- {
- if (RepartiendoCajas[playerid] == false)
- {
- if(IsPlayerInAnyVehicle(playerid))
- {
- SendClientMessage(playerid,Verde,"Repariendo...");
- SendClientMessage(playerid,Verde,"Dirigete a los checkpoints (puntos rojos).");
- new randomize;
- randomize = random(sizeof(PuntosRPeriodicos));
- SetPlayerCheckpoint(playerid, PuntosRepartidor[randomize][0], PuntosRepartidor[randomize][1], PuntosRepartidor[randomize][2], 5.0);
- RepartiendoCajas[playerid] = true;
- return 1;
- }
- return SendClientMessage(playerid,Rojo,"[Error] No estas en un coche!");
- }
- return SendClientMessage(playerid,Rojo,"[Error] Usted ya esta repartiendo!");
- }
- if (strcmp("/dRepartir", cmdtext, true, 10) == 0)
- {
- if (RepartiendoCajas[playerid] == true)
- {
- SendClientMessage(playerid,Verde,"Dejaste de repartir.");
- RepartiendoCajas[playerid] = false;
- DisablePlayerRaceCheckpoint(playerid);
- return 1;
- }
- return SendClientMessage(playerid,Rojo,"[Error] Usted no esta repartiendo!");
- }
- /* Pescador */
- if (strcmp("/Pescar", cmdtext, true, 10) == 0)
- {
- if (EstaPescando[playerid] == false)
- {
- if(EstaEnZonaPesca(playerid))
- {
- SendClientMessage(playerid,Verde,"Pescando...");
- EstaPescando[playerid] = true;
- SetTimerEx("Pescando", 5000, 0, "d", playerid);
- return 1;
- }
- return SendClientMessage(playerid,Rojo,"[Error] No estas en el muelle!");
- }
- return SendClientMessage(playerid,Rojo,"[Error] Usted no esta pescando!");
- }
- if (strcmp("/dPescar", cmdtext, true, 10) == 0)
- {
- if (EstaPescando[playerid] == true)
- {
- SendClientMessage(playerid,Verde,"Dejaste de pescar.");
- EstaPescando[playerid] = false;
- DisablePlayerRaceCheckpoint(playerid);
- return 1;
- }
- return SendClientMessage(playerid,Rojo,"[Error] Usted no esta pescando!");
- }
- if (strcmp("/Ayudame", cmdtext, true, 10) == 0)
- {
- new Mensajeayuda[600];
- format(Mensajeayuda, sizeof(Mensajeayuda),
- "{00F50A}|____________________Sistema de trabajos Badyx____________________| {F0F0F0}\n");
- strcat(Mensajeayuda, "{F5FF00}\n\n[Repartidor de periodicos] Use /RepartirPeriodicos para empezar a repartir\nUse /DrepartirPeriodicos para dejar de repartir\n[Info] Tendras que estar en una bicicleta e ir a los puntos marcados\n\n");
- strcat(Mensajeayuda, "{F5FF00}\n\n[Repartidos] Use /Repartir para empezar a repartir\nUse /Drepartir para dejar de repartir\n[Info] No se requiere nada en especial\n\n");
- strcat(Mensajeayuda, "{F5FF00}\n\n[Pescador] Use /Pescar para lanzar su caña\nUse /dPescar para dejar de pescar\n[Info] Se requiere estar en el puerto\n\n");
- ShowPlayerDialog(playerid, 999, DIALOG_STYLE_MSGBOX, "{00A5FF}Ayuda Trabajos.", Mensajeayuda, "Aceptar", "");
- return 1;
- }
- if (strcmp("/CPosicionRPeriodico", cmdtext, true, 10) == 0)
- {
- if(IsPlayerAdmin(playerid))
- {
- new Float:x,Float:y,Float:z;
- GetPlayerPos(playerid, x, y, z);
- new Float:angle;
- GetPlayerFacingAngle(playerid, angle);
- RepartidorPeriodicos[X] = x;
- RepartidorPeriodicos[Y] = y;
- RepartidorPeriodicos[Z] = z;
- RepartidorPeriodicos[World] = GetPlayerVirtualWorld(playerid);
- RepartidorPeriodicos[Interior] = GetPlayerInterior(playerid);
- RepartidorPeriodicos[Angle] = angle;
- MoveStreamPickup(RepartidorPeriodicos[PickupID],RepartidorPeriodicos[X],RepartidorPeriodicos[Y],RepartidorPeriodicos[Z]);
- GuardarPosJobRPeriodicos();
- SendClientMessage(playerid, Verde, "[Info] Cambiaste correctamente la posicion del trabajo de repartidor de periodicos");
- return 1;
- }
- return SendClientMessage(playerid,Rojo,"[Error] Se requiere que usted este logeado con rcon");
- }
- if (strcmp("/CPosicionRepartidor", cmdtext, true, 10) == 0)
- {
- if(IsPlayerAdmin(playerid))
- {
- new Float:x,Float:y,Float:z;
- GetPlayerPos(playerid, x, y, z);
- new Float:angle;
- GetPlayerFacingAngle(playerid, angle);
- Repartidor[X] = x;
- Repartidor[Y] = y;
- Repartidor[Z] = z;
- Repartidor[World] = GetPlayerVirtualWorld(playerid);
- Repartidor[Interior] = GetPlayerInterior(playerid);
- Repartidor[Angle] = angle;
- MoveStreamPickup(Repartidor[PickupID],Repartidor[X],Repartidor[Y],Repartidor[Z]);
- GuardarPosJobRepartidor();
- SendClientMessage(playerid, Verde, "[Info] Cambiaste correctamente la posicion del trabajo de repartidor");
- return 1;
- }
- return SendClientMessage(playerid,Rojo,"[Error] Se requiere que usted este logeado con rcon");
- }
- return 0;
- }
- funcion Pescando(playerid)
- {
- new RandomPesca = random(11);
- switch(RandomPesca)
- {
- case 0: {SendClientMessage(playerid,Rojo,"[Error] El hilo de tu caña se a roto!");return 1;}
- case 1: {SendClientMessage(playerid,Verde,"Encontraste un calcetin con 100 de dinero"); GivePlayerMoney(playerid, 100);return 1;}
- case 2: {SendClientMessage(playerid,Verde,"Encontraste un calcetin con 20 de dinero"); GivePlayerMoney(playerid, 100);return 1;}
- case 3: {SendClientMessage(playerid,Verde,"Pescaste un atun y lo vendiste por 10 de dinero");GivePlayerMoney(playerid, 10);return 1;}
- case 4: {SendClientMessage(playerid,Rojo,"[Error] El hilo de tu caña se a roto!");return 1;}
- case 5: {SendClientMessage(playerid,Verde,"Pescaste un pulpo y lo vendiste por 20 de dinero");GivePlayerMoney(playerid, 20);return 1;}
- case 6: {SendClientMessage(playerid,Verde,"Pescaste una sardina y lo vendiste por 1 de dinero");GivePlayerMoney(playerid, 1);return 1;}
- case 7: {SendClientMessage(playerid,Rojo,"[Error] El hilo de tu caña se a roto!");return 1;}
- case 8: {SendClientMessage(playerid,Verde,"Encontraste un calcetin con 50 de dinero"); GivePlayerMoney(playerid, 100);return 1;}
- case 9: {SendClientMessage(playerid,Rojo,"[Error] El hilo de tu caña se a roto!");return 1;}
- case 10: {SendClientMessage(playerid,Rojo,"[Error] El hilo de tu caña se a roto!");return 1;}
- }
- return 1;
- }
- funcion EsBicicleta(vehicleid)
- {
- new model = GetVehicleModel(vehicleid);
- if(model == 481 || model == 509 || model == 510)
- {
- return 1;
- }
- return 0;
- }
- funcion OnPlayerEnterCheckpoint(playerid)
- {
- new string[30];
- new Pasta = random(20), randomize;
- if (RepartiendoPeriodicos[playerid] == true)
- {
- if(EsBicicleta(GetPlayerVehicleID(playerid)))
- {
- PlayerPlaySound(playerid, 1056, 0.0, 0.0, 0.0);
- format(string, sizeof(string), "~w~Te pagaron~n~~g~$%d",Pasta);
- GameTextForPlayer(playerid, string, 5000, 1);
- GivePlayerMoney(playerid, Pasta);
- randomize = random(sizeof(PuntosRPeriodicos));
- SetPlayerCheckpoint(playerid, PuntosRPeriodicos[randomize][0], PuntosRPeriodicos[randomize][1], PuntosRPeriodicos[randomize][2], 5.0);
- }
- return 1;
- }
- if (RepartiendoCajas[playerid] == true)
- {
- PlayerPlaySound(playerid, 1056, 0.0, 0.0, 0.0);
- format(string, sizeof(string), "~w~Te pagaron~n~~g~$%d",Pasta);
- GameTextForPlayer(playerid, string, 5000, 1);
- GivePlayerMoney(playerid, Pasta);
- randomize = random(sizeof(PuntosRepartidor));
- SetPlayerCheckpoint(playerid, PuntosRepartidor[randomize][0], PuntosRepartidor[randomize][1], PuntosRepartidor[randomize][2], 5.0);
- return 1;
- }
- return 1;
- }
- funcion EstaEnZonaPesca(playerid)
- {
- if(IsPlayerConnected(playerid))
- {
- if(IsPlayerInRangeOfPoint(playerid,2,403.8346,-2088.3628,7.8359) || IsPlayerInRangeOfPoint(playerid,2,398.6683,-2088.4817,7.8359))
- {
- return 1;
- }
- else if(IsPlayerInRangeOfPoint(playerid,2,396.0295,-2088.3022,7.8359) || IsPlayerInRangeOfPoint(playerid,2,391.0287,-2088.2808,7.8359))
- {
- return 1;
- }
- else if(IsPlayerInRangeOfPoint(playerid,2,383.2155,-2088.3271,7.8359) || IsPlayerInRangeOfPoint(playerid,2,375.0619,-2088.2026,7.8359))
- {
- return 1;
- }
- else if(IsPlayerInRangeOfPoint(playerid,2,369.8253,-2088.4463,7.8359) || IsPlayerInRangeOfPoint(playerid,2,367.2083,-2088.3237,7.8359))
- {
- return 1;
- }
- else if(IsPlayerInRangeOfPoint(playerid,2,362.1855,-2088.4866,7.8359) || IsPlayerInRangeOfPoint(playerid,2,354.4520,-2088.3418,7.8359))
- {
- return 1;
- }
- }
- return 0;
- }
- funcion CargarPosJobRPeriodicos()
- {
- new arrCoords[7][64];
- new strFromFile2[256];
- new File: file = fopen("Trabajos/RepartidorPeriodicos.cfg", io_read);
- if (file)
- {
- fread(file, strFromFile2);
- split(strFromFile2, arrCoords, '|');
- RepartidorPeriodicos[X] = floatstr(arrCoords[0]);
- RepartidorPeriodicos[Y] = floatstr(arrCoords[1]);
- RepartidorPeriodicos[Z] = floatstr(arrCoords[2]);
- RepartidorPeriodicos[World] = strval(arrCoords[3]);
- RepartidorPeriodicos[Interior] = strval(arrCoords[4]);
- RepartidorPeriodicos[Angle] = floatstr(arrCoords[5]);
- RepartidorPeriodicos[PickupID] = strval(arrCoords[6]);
- RepartidorPeriodicos[PickupID] = CreateStreamPickup(1239,1,RepartidorPeriodicos[X],RepartidorPeriodicos[Y],RepartidorPeriodicos[Z],PICKUP_RANGE);
- print("[Info] Posicion de trabajo de repartidor periodicos cargada");
- }
- fclose(file);
- return 1;
- }
- funcion GuardarPosJobRPeriodicos()
- {
- new File: file2;
- new coordsstring[512];
- format(coordsstring, sizeof(coordsstring), "%f|%f|%f|%d|%d|%f|%d\n",
- RepartidorPeriodicos[X],
- RepartidorPeriodicos[Y],
- RepartidorPeriodicos[Z],
- RepartidorPeriodicos[World],
- RepartidorPeriodicos[Interior],
- RepartidorPeriodicos[Angle],
- RepartidorPeriodicos[PickupID]);
- file2 = fopen("Trabajos/RepartidorPeriodicos.cfg", io_write);
- fwrite(file2, coordsstring);
- fclose(file2);
- return 1;
- }
- funcion CargarPosJobRepartidor()
- {
- new arrCoords[7][64];
- new strFromFile2[256];
- new File: file = fopen("Trabajos/Repartidor.cfg", io_read);
- if (file)
- {
- fread(file, strFromFile2);
- split(strFromFile2, arrCoords, '|');
- Repartidor[X] = floatstr(arrCoords[0]);
- Repartidor[Y] = floatstr(arrCoords[1]);
- Repartidor[Z] = floatstr(arrCoords[2]);
- Repartidor[World] = strval(arrCoords[3]);
- Repartidor[Interior] = strval(arrCoords[4]);
- Repartidor[Angle] = floatstr(arrCoords[5]);
- Repartidor[PickupID] = strval(arrCoords[6]);
- Repartidor[PickupID] = CreateStreamPickup(1239,1,Repartidor[X],Repartidor[Y],Repartidor[Z],PICKUP_RANGE);
- print("[Info] Posicion de trabajo de repartidor cargada");
- }
- fclose(file);
- return 1;
- }
- funcion GuardarPosJobRepartidor()
- {
- new File: file2;
- new coordsstring[512];
- format(coordsstring, sizeof(coordsstring), "%f|%f|%f|%d|%d|%f|%d\n",
- Repartidor[X],
- Repartidor[Y],
- Repartidor[Z],
- Repartidor[World],
- Repartidor[Interior],
- Repartidor[Angle],
- Repartidor[PickupID]);
- file2 = fopen("Trabajos/Repartidor.cfg", io_write);
- fwrite(file2, coordsstring);
- fclose(file2);
- return 1;
- }
- funcion CreateStreamPickup(model,type,Float:x,Float:y,Float:z,range)
- {
- new FoundID = 0;
- new ID;
- for ( new i = 0; FoundID <= 0 ; i++)
- {
- if( Pickup[i][pickupCreated] == 0 )
- {
- if( FoundID == 0 )
- {
- ID = i;
- FoundID = 1;
- }
- }
- if( i > MAX_S_PICKUPS )
- {
- FoundID = 2;
- }
- }
- if( FoundID == 2 )
- {
- print("[Error] Maximo de Pickups excedidos. El pickup no fue creado");
- return -1;
- }
- Pickup[ID][pickupCreated] = 1;
- Pickup[ID][pickupVisible] = 0;
- Pickup[ID][pickupModel] = model;
- Pickup[ID][pickupType] = type;
- Pickup[ID][pickupX] = x;
- Pickup[ID][pickupY] = y;
- Pickup[ID][pickupZ] = z;
- Pickup[ID][pickupRange] = range;
- return ID;
- }
- funcion split(const strsrc[], strdest[][], delimiter)
- {
- new i, li;
- new aNum;
- new len;
- while(i <= strlen(strsrc)){
- if(strsrc[i]==delimiter || i==strlen(strsrc)){
- len = strmid(strdest[aNum], strsrc, li, i, 128);
- strdest[aNum][len] = 0;
- li = i+1;
- aNum++;
- }
- i++;
- }
- return 1;
- }
- funcion MoveStreamPickup(ID,Float:x,Float:y,Float:z)
- {
- if(Pickup[ID][pickupCreated])
- {
- DestroyPickup(Pickup[ID][pickupID]);
- Pickup[ID][pickupVisible] = 0;
- Pickup[ID][pickupX] = x;
- Pickup[ID][pickupY] = y;
- Pickup[ID][pickupZ] = z;
- return 1;
- }
- return 0;
- }
- funcion MostrarInformacion()
- {
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerInRangeOfPoint(i,1.0,RepartidorPeriodicos[X],RepartidorPeriodicos[Y],RepartidorPeriodicos[Z]))
- {
- if(GetPlayerVirtualWorld(i) == RepartidorPeriodicos[World])
- {
- GameTextForPlayer(i, "Aqui podras trabajar como repartidor de periodicos", 5000, 1);
- }
- }
- else if(IsPlayerInRangeOfPoint(i,1.0,Repartidor[X],Repartidor[Y],Repartidor[Z]))
- {
- if(GetPlayerVirtualWorld(i) == Repartidor[World])
- {
- GameTextForPlayer(i, "Aqui podras trabajar como repartidor", 5000, 1);
- }
- }
- }
- return 1;
- }
- //============================================================================//
- // //
- // FINAL DEL SCRIPT //
- // //
- // SI TE SIRVIO RESPETA EL TRABAJO DEL CREADOR //
- // //
- //============================================================================//
Advertisement
Add Comment
Please, Sign In to add comment