Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Trabalho de caminhoneiro
- By Parka
- Desenvolvido 03:19 a.m. 19/07/2013
- Versão: 0.1x RC 2 - Desenvolvido 03:19 a.m. 15/09/2013
- Introdução
- O presente trabalho, é um sistema Trabalho de caminhoneiro você pode criar suas
- próprias posições de carregamento e descarregamento automaticamente armazenados
- na scriptfiles/Trucking/Locations para quando você tem a necessidade de reiniciar
- seu servidor, não perderá os locais, tem também a nome carga e nome do alvo graças
- a Include a_zones.
- Desenvolvimento
- /Carregar :
- Para começar a trabalhar.
- /tutolc:
- Para os administradores sabem como usar /createlc.
- /createlc <Player> :
- Usar /createlc para criar a Localidade onde o jogador carregar o trailer.
- Sua posição: é onde carregar o trailer.
- Player posição: é onde descer o trailer.
- Neste sistema, o reboques são divididos em três tipos de cargas, Exigir nível
- necessário para realizar.
- 1- Easy
- 2-Medium 4-6
- 3-Hard 7 >
- caminhoneiro:
- A restrição é baseada na pele, deve colocar a skin do caminhoneiro na segue variable:
- SkinTruckDriver[4]
- e onde está localizada a quatro adicioná mais.
- */
- #include < a_samp >// SAMP-TEAM
- #include < sscanf2 >// Y_Less
- #include < A_ZONES >// By ~Cueball~
- #include < ZCMD >// Zeex
- #include < DOF2 >// Double-o-Seven
- #define Locations_Save "Trucking/Locations/%d.txt"
- #define Save_ID "Trucking/Quantidade.txt"
- #undef MAX_PLAYERS
- #define MAX_PLAYERS 100
- new p_Get_Quantidade;
- new p_Quantidade;
- new p_ForID;
- new p_JopStatus[MAX_PLAYERS];
- new bool:p_Jop[MAX_PLAYERS];
- new Float:p_OldPos[MAX_PLAYERS][3];
- enum p_LAU
- {
- Float:Carregar_Posx,
- Float:Carregar_Posy,
- Float:Carregar_Posz,
- Float:Baixar_Posx,
- Float:Baixar_Posy,
- Float:Baixar_Posz
- }
- new LoadAndUnload[][p_LAU];
- new SkinTruckDriver[4] =// adicionar a pele do seu GM (de Truck Driver)
- {
- 133,
- 202,
- 206,
- 261
- };
- // ========[Trucking Job By Parka]======== //
- forward p_StopWork_LostTrailer( playerid );
- public p_StopWork_LostTrailer( playerid )
- {
- DisablePlayerCheckpoint(playerid);
- SendClientMessage(playerid, 0xFF0000AA, "Você perdido o Trailer, descontado -$1000.");
- SendClientMessage(playerid, 0xFF0000AA, "Você está demitido.");
- GivePlayerMoney(playerid, -1000);
- p_JopStatus[playerid] = 0;
- p_Jop[ playerid ] = false;
- return 1;
- }
- // ========[Trucking Job By Parka]======== //
- forward p_StopWork( playerid );
- public p_StopWork( playerid )
- {
- DisablePlayerCheckpoint(playerid);
- SendClientMessage(playerid, 0xFF0000AA, "Você escapou de seu trabalho é descontado -$1000");
- GivePlayerMoney(playerid, -1000);
- p_JopStatus[playerid] = 0;
- p_Jop[ playerid ] = false;
- return 1;
- }
- // ========[Trucking Job By Parka]======== //
- forward p_LoadAndUnload( playerid );
- public p_LoadAndUnload( playerid )
- {
- new v = GetPlayerVehicleID(playerid);
- new p_All, p_Pay, Float:p_THealth, Float:p_CHealth, string[256];
- GetVehicleHealth(v, p_CHealth);
- GetVehicleHealth(GetVehicleTrailer(v),p_THealth);
- switch(p_JopStatus[ playerid ])
- {
- case 1:
- {
- DisablePlayerCheckpoint( playerid );
- SetPlayerCheckpoint( playerid, p_OldPos[ playerid ][ 0 ], p_OldPos[ playerid ][ 1 ], p_OldPos[ playerid ][ 2 ], 7);
- SendClientMessage( playerid, 0xFFFF00AA, "Caminhão carregado referem-se a e ponto de descarga");
- TogglePlayerControllable( playerid , true );
- p_JopStatus[ playerid ] = 2;
- }
- case 2:
- {
- switch(GetVehicleModel(GetVehicleTrailer(v)))
- {
- case 450://Easy Level 1 a 3
- {
- p_All = floatround(p_CHealth) + floatround(p_THealth);
- p_Pay = p_All * 2;
- format( string, sizeof string,
- "{00ff00}[!]==========[Detalhes do pagamento]==========[!]\n\
- {00ff00}Danos do Trailer: %d\n\
- {00ff00}Danos do Camion: %d\n\
- {00ff00}Total a pagar: %d", floatround(p_THealth), floatround(p_CHealth), p_Pay);
- ShowPlayerDialog( playerid, 0x00100, DIALOG_STYLE_MSGBOX,"[Detalhes do pagamento]", string, "Aceptar", "");
- GivePlayerMoney( playerid , p_Pay );
- TogglePlayerControllable( playerid , true );
- p_JopStatus[ playerid ] = 2;
- p_Jop [ playerid ] = true;
- }
- case 435,591://Medium Level 4 a 6
- {
- p_All = floatround(p_CHealth) + floatround(p_THealth);
- p_Pay = p_All * 3;
- format( string, sizeof string,
- "{00ff00}[!]==========[Detalhes do pagamento]==========[!]\n\
- {00ff00}Danos do Trailer: %d\n\
- {00ff00}Danos do Camion: %d\n\
- {00ff00}Total a pagar: %d", floatround(p_THealth), floatround(p_CHealth), p_Pay);
- ShowPlayerDialog( playerid, 0x00100, DIALOG_STYLE_MSGBOX,"[Detalhes do pagamento]", string, "Aceptar", "");
- GivePlayerMoney( playerid , p_Pay );
- TogglePlayerControllable( playerid , true );
- p_JopStatus[ playerid ] = 2;
- p_Jop [ playerid ] = true;
- }
- case 584://Hard Level 7 a 9
- {
- p_All = floatround(p_CHealth) + floatround(p_THealth);
- p_Pay = p_All * 4;
- format( string, sizeof string,
- "{00ff00}[!]==========[Detalhes do pagamento]==========[!]\n\
- {00ff00}Danos do Trailer: %d\n\
- {00ff00}Danos do Camion: %d\n\
- {00ff00}Total a pagar: %d", floatround(p_THealth), floatround(p_CHealth), p_Pay);
- ShowPlayerDialog( playerid, 0x00100, DIALOG_STYLE_MSGBOX,"[Detalhes do pagamento]", string, "Aceptar", "");
- GivePlayerMoney( playerid , p_Pay );
- TogglePlayerControllable( playerid , true );
- p_JopStatus[ playerid ] = 2;
- p_Jop [ playerid ] = true;
- }
- }
- }
- }
- return 1;
- }
- // ========[Trucking Job By Parka]======== //
- forward GetTruckDriver( playerid );
- public GetTruckDriver( playerid )
- {
- for(new i; i < sizeof SkinTruckDriver; i++)
- {
- if( GetPlayerSkin(playerid) == SkinTruckDriver[i])
- {
- return 1;
- }
- }
- return 0;
- }
- // ========[Trucking Job By Parka]======== //
- forward PosForID();
- public PosForID()
- {
- if(DOF2_FileExists( Save_ID ) )
- {
- p_Quantidade = DOF2_GetInt( Save_ID , "Quantidade" ) + 1;
- DOF2_SetInt( Save_ID , "Quantidade" , p_Quantidade );
- DOF2_SaveFile();
- }
- return p_Quantidade;
- }
- // ========[Trucking Job By Parka]======== //
- forward PlayerStartWork( playerid );
- public PlayerStartWork( playerid )
- {
- new v = GetPlayerVehicleID(playerid);
- if(GetVehicleModel(v)==403||GetVehicleModel(v)==515||GetVehicleModel(v)==514)
- {
- if(IsTrailerAttachedToVehicle(v))
- {
- switch(GetVehicleModel(GetVehicleTrailer(v)))
- {
- case 450://Easy Level 1 a 3
- {
- SetPosDestination( playerid );
- }
- case 435,591://Medium Level 4 a 6
- {
- if(GetPlayerScore(playerid) <= 3) return SendClientMessage( playerid, 0xFF0000AA, "Deve ser Nível 4 para transportar carga de mídia");
- SetPosDestination( playerid );
- }
- case 584://Hard Level 7 a 9
- {
- if(GetPlayerScore(playerid) <= 6) return SendClientMessage( playerid, 0xFF0000AA, "Deve ser Nível 7 para transportar carga de pesado");
- SetPosDestination( playerid );
- }
- }
- }else return SendClientMessage( playerid, 0xFF0000AA, "Você não tem um trailer viciado");
- }
- else return SendClientMessage( playerid, 0xFF0000AA, "Você deve estar dentro de um caminhão");
- return true;
- }
- // ========[Trucking Job By Parka]======== //
- forward SetPosDestination( playerid );
- public SetPosDestination( playerid )
- {
- if(DOF2_FileExists( Save_ID ) ){
- p_Get_Quantidade = DOF2_GetInt( Save_ID , "Quantidade");
- }
- new p_random = random(p_Get_Quantidade);
- new Float:p_LastPos[MAX_PLAYERS][3];
- new string[32];
- format( string, sizeof string, Locations_Save, p_random);
- if( !DOF2_FileExists( string ) )
- return SendClientMessage( playerid, 0xFF0000AA, "Isso nunca deveria aparecer");
- LoadAndUnload[ p_random ][ Carregar_Posx] = DOF2_GetFloat( string, "Carregar_X");
- LoadAndUnload[ p_random ][ Carregar_Posy] = DOF2_GetFloat( string, "Carregar_Y");
- LoadAndUnload[ p_random ][ Carregar_Posz] = DOF2_GetFloat( string, "Carregar_Z");
- LoadAndUnload[ p_random ][ Baixar_Posx] = DOF2_GetFloat ( string, "Baixar_X" );
- LoadAndUnload[ p_random ][ Baixar_Posy] = DOF2_GetFloat ( string, "Baixar_Y" );
- LoadAndUnload[ p_random ][ Baixar_Posz] = DOF2_GetFloat ( string, "Baixar_Z" );
- p_LastPos[ playerid ][ 0 ] = LoadAndUnload[ p_random ][ Carregar_Posx ];
- p_LastPos[ playerid ][ 1 ] = LoadAndUnload[ p_random ][ Carregar_Posy ];
- p_LastPos[ playerid ][ 2 ] = LoadAndUnload[ p_random ][ Carregar_Posz ];
- p_OldPos[ playerid ][ 0 ] = LoadAndUnload[ p_random ][ Baixar_Posx ];
- p_OldPos[ playerid ][ 1 ] = LoadAndUnload[ p_random ][ Baixar_Posy ];
- p_OldPos[ playerid ][ 2 ] = LoadAndUnload[ p_random ][ Baixar_Posz ];
- SetPlayerCheckpoint(playerid, p_LastPos[ playerid ][ 0 ], p_LastPos[ playerid ][ 1 ], p_LastPos[ playerid ][ 2 ], 7);
- new StrIng_Text[256];
- format( StrIng_Text, sizeof StrIng_Text, "%s", DOF2_GetString( string, "Localidade"));
- SendClientMessage( playerid, 0x00FF00AA, StrIng_Text);
- p_JopStatus[ playerid ] = 1;
- p_Jop [ playerid ] = true;
- return 1;
- }
- // ========[Trucking Job By Parka]======== //
- forward SaveLocations( LocationName[], Float:Carregar_x, Float:Carregar_y, Float:Carregar_z, Float:Baixar_x, Float:Baixar_y, Float:Baixar_z );
- public SaveLocations( LocationName[], Float:Carregar_x, Float:Carregar_y, Float:Carregar_z, Float:Baixar_x, Float:Baixar_y, Float:Baixar_z )
- {
- if(!DOF2_FileExists(TKSave()))
- {
- DOF2_CreateFile ( TKSave());
- DOF2_SetString ( TKSave(), "Localidade", LocationName);
- DOF2_SetFloat ( TKSave(), "Carregar_X", Carregar_x );
- DOF2_SetFloat ( TKSave(), "Carregar_Y", Carregar_y );
- DOF2_SetFloat ( TKSave(), "Carregar_Z", Carregar_z );
- DOF2_SetFloat ( TKSave(), "Baixar_X" , Baixar_x );
- DOF2_SetFloat ( TKSave(), "Baixar_Y" , Baixar_y );
- DOF2_SetFloat ( TKSave(), "Baixar_Z" , Baixar_z );
- DOF2_SaveFile();
- }
- return 1;
- }
- // ========[Trucking Job By Parka]======== //
- stock TKSave()
- {
- new string[32];
- format( string, sizeof string, Locations_Save, p_ForID);
- return string;
- }
- // ========[Trucking Job By Parka]======== //
- CMD:createlc(playerid,params[])
- {
- if( !IsPlayerAdmin( playerid ) ) return SendClientMessage( playerid, 0xFF0000AA, "Você não é administrador /RCON");
- new Target;
- if( sscanf( params, "d", Target) ) return SendClientMessage( playerid, 0xFF0000AA, "Use: '/createlc <Player>' ajuda = (/tutolc)");
- if( !IsPlayerConnected(Target) || Target == INVALID_PLAYER_ID ) return SendClientMessage( playerid, 0xFF0000AA, "Jogador não conectado");
- //if( Target == playerid ) return SendClientMessage( playerid, 0xFF0000AA, "Você não pode ser você mesmo");
- new Float:TargetPos[3];
- new Float:PlayerPos[3];
- GetPlayerPos( playerid, PlayerPos[0], PlayerPos[1], PlayerPos[2]);
- GetPlayerPos( Target, TargetPos[0], TargetPos[1], TargetPos[2]);
- p_ForID = PosForID();
- new Zone_Target[32];
- new Zone_Player[32];
- GetPlayer3DZone( Target, Zone_Target, 32);
- GetPlayer3DZone( playerid, Zone_Player, 32);
- new Str_Ing[256];
- format( Str_Ing, sizeof Str_Ing, "Trabalhar: Carregar em %s e Transportar a %s", Zone_Player, Zone_Target);
- SaveLocations( Str_Ing, PlayerPos[0], PlayerPos[1], PlayerPos[2], TargetPos[0], TargetPos[1], TargetPos[2] );
- SendClientMessage( playerid, 0x00FF00AA, "a Localidade foi salva satisfatoriamente");
- SendClientMessage( Target, 0x00FF00AA, "a Localidade foi salva satisfatoriamente");
- return 1;
- }
- // ========[Trucking Job By Parka]======== //
- CMD:tutolc(playerid,params[])
- {
- SendClientMessage( playerid, 0xFFFF00AA, "Usar /createlc para criar a Localidade onde o jogador carregar o trailer.");
- SendClientMessage( playerid, 0xFFFF00AA, "Sua posição: é onde carregar o trailer.");
- SendClientMessage( playerid, 0xFFFF00AA, "Player posição: é onde descer o trailer.");
- return 1;
- }
- // ========[Trucking Job By Parka]======== //
- CMD:carregar(playerid,params[])
- {
- SetPlayerScore(playerid, 4);
- if( IsPlayerConnected( playerid ) )
- {
- if( p_Jop[ playerid ] == false )
- {
- if(GetTruckDriver(playerid))
- {
- PlayerStartWork( playerid );
- }
- else return SendClientMessage( playerid, 0xFF0000AA, "Você não é truck driver.");
- }
- else return SendClientMessage( playerid, 0xFF0000AA, "Você já está trabalhando.");
- }
- return 1;
- }
- // ========[Trucking Job By Parka]======== //
- public OnFilterScriptInit()
- {
- if(!DOF2_FileExists( Save_ID ) )
- {
- DOF2_CreateFile( Save_ID );
- DOF2_SetInt( Save_ID , "Quantidade" , -1);
- DOF2_SaveFile();
- }
- return 1;
- }
- // ========[Trucking Job By Parka]======== //
- public OnFilterScriptExit()
- {
- DOF2_Exit();
- return 1;
- }
- // ========[Trucking Job By Parka]======== //
- public OnPlayerConnect(playerid)
- {
- p_Jop [ playerid ] = false;
- p_JopStatus[ playerid ] = 0;
- return 1;
- }
- // ========[Trucking Job By Parka]======== //
- public OnPlayerEnterCheckpoint(playerid)
- {
- if( IsPlayerConnected( playerid ) )
- {
- switch(p_JopStatus[ playerid ])
- {
- case 1:
- {
- GameTextForPlayer( playerid, "~y~~h~Carregar os produtos~n~~p~Espere por favor..", 10000, 1);
- TogglePlayerControllable( playerid, false);
- SetTimerEx("p_LoadAndUnload", 10000, false, "d", playerid);
- }
- case 2:
- {
- GameTextForPlayer( playerid, "~g~~h~Baixando os produtos~n~~p~Espere por favor..", 10000, 1);
- TogglePlayerControllable( playerid, false);
- SetTimerEx("p_LoadAndUnload", 10000, false, "d", playerid);
- }
- }
- }
- return 1;
- }
- // ========[Trucking Job By Parka]======== //
- public OnPlayerLeaveCheckpoint(playerid)
- {
- if( IsPlayerConnected( playerid ) )
- {
- DisablePlayerCheckpoint(playerid);
- }
- return 1;
- }
- // ========[Trucking Job By Parka]======== //
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- new v = GetPlayerVehicleID(playerid);
- if(!IsTrailerAttachedToVehicle(v) && p_JopStatus[ playerid ] >= 1)
- {
- p_StopWork_LostTrailer(playerid);
- }
- return 1;
- }
- /*
- Trucking Job
- By Parka
- Desenvolvido 03:19 a.m. 19/07/2013
- Versão: 0.1a[BETA]
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement