28.12.2011, 16:22
Quote:
Код:
...\ass\Pawno\include\rLibrary.inc(1) : error 010: invalid function or declaration ...\ass\gamemodes\a9.pwn(64996) : warning 202: number of arguments does not match definition |
rLibrary
Код:
/* ******************************** nLibrary - Neon Library ******************************** Description: Allows you to attach neons to the selected vehicle. Version: 1.5 Developer: Luke "Shelby" Godoy. ChangeLOG: 20/10/2011: Small fixes. 20/06/2011: Buzzer can be used with neons. 19/06/2011: Buzzer(neon) available for attachment. 18/06/2011: Improvement in the speed of the functions 'GetVehicleNeonColor' & 'IsVehicleUsingNeon' Thanks to: ScripterTroll. Changes in native 'IsVehicleUsingNeon'. 17/06/2011: First version. Thanks To: CiNyC - Insanity Vehicle Attachment Editor Natives: native AttachNeonToVehicle(vehicleid, neonid); native RemoveNeonFromVehicle(vehicleid); native IsVehicleUsingNeon(vehicleid); native GetVehicleNeonColor(vehicleid); native IsVehicleUsingBuzzer(vehicleid); native RemoveBuzzerFromVehicle(vehicleid); */ #include <a_samp> #if defined _nLibrary_included #endinput #endif #define _nLibrary_included #define NEON_BLUE (0) #define NEON_PINK (1) #define NEON_YELLOW (2) #define NEON_GREEN (3) #define NEON_RED (4) #define NEON_WHITE (5) #define NEON_POLICE (6) #define GetVehicleNeonColor(%0) NEON_COR[%0] #define IsVehicleUsingNeon(%0) IsValidObject(NEON_ONE[%0]) #define IsVehicleUsingBuzzer(%0) IsValidObject(NEON_THR[%0]) #define RemoveBuzzerFromVehicle(%0); DestroyObject(NEON_THR[%0]); \ NEON_THR[%0] = INVALID_OBJECT_ID; new NEON_ONE[MAX_VEHICLES] = {INVALID_OBJECT_ID, ...}; new NEON_TWO[MAX_VEHICLES] = {INVALID_OBJECT_ID, ...}; new NEON_THR[MAX_VEHICLES] = {INVALID_OBJECT_ID, ...}; new NEON_COR[MAX_VEHICLES][10]; stock Bike(vehicleid) { new model = GetVehicleModel(vehicleid); if(model == 522 || model == 462 || model == 521 || model == 461 || model == 463 || model == 581 || model == 448 || model == 586 || model == 523 || model == 468 || model == 471 || model == 509 || model == 510 || model == 481) return 1; return 0; } stock AttachNeonToVehicle(vehicleid, neonid /*, playerid = INVALID_PLAYER_ID*/ ) { switch(neonid) { case NEON_BLUE: { DestroyObject(NEON_ONE[vehicleid]); DestroyObject(NEON_TWO[vehicleid]); if(Bike(vehicleid)){NEON_ONE[vehicleid] = CreateObject(18648,0,0,0,0,0,0); AttachObjectToVehicle(NEON_ONE[vehicleid], vehicleid, 0.0, 0.0, -0.70, 0.0, 0.0, 0.0); NEON_TWO[vehicleid] = INVALID_OBJECT_ID; return 1;} NEON_ONE[vehicleid] = CreateObject(18648,0,0,0,0,0,0); NEON_TWO[vehicleid] = CreateObject(18648,0,0,0,0,0,0); AttachObjectToVehicle(NEON_ONE[vehicleid], vehicleid, -0.8, 0.0, -0.70, 0.0, 0.0, 0.0); AttachObjectToVehicle(NEON_TWO[vehicleid], vehicleid, 0.8, 0.0, -0.70, 0.0, 0.0, 0.0); NEON_COR[vehicleid] = "Blue"; return 1; } case NEON_PINK: { DestroyObject(NEON_ONE[vehicleid]); DestroyObject(NEON_TWO[vehicleid]); if(Bike(vehicleid)){NEON_ONE[vehicleid] = CreateObject(18651,0,0,0,0,0,0); AttachObjectToVehicle(NEON_ONE[vehicleid], vehicleid, 0.0, 0.0, -0.70, 0.0, 0.0, 0.0); NEON_TWO[vehicleid] = INVALID_OBJECT_ID; return 1;} NEON_ONE[vehicleid] = CreateObject(18651,0,0,0,0,0,0); NEON_TWO[vehicleid] = CreateObject(18651,0,0,0,0,0,0); AttachObjectToVehicle(NEON_ONE[vehicleid], vehicleid, -0.8, 0.0, -0.70, 0.0, 0.0, 0.0); AttachObjectToVehicle(NEON_TWO[vehicleid], vehicleid, 0.8, 0.0, -0.70, 0.0, 0.0, 0.0); NEON_COR[vehicleid] = "Pink"; return 1; } case NEON_YELLOW: { DestroyObject(NEON_ONE[vehicleid]); DestroyObject(NEON_TWO[vehicleid]); if(Bike(vehicleid)){NEON_ONE[vehicleid] = CreateObject(18650,0,0,0,0,0,0); AttachObjectToVehicle(NEON_ONE[vehicleid], vehicleid, 0.0, 0.0, -0.70, 0.0, 0.0, 0.0); NEON_TWO[vehicleid] = INVALID_OBJECT_ID; return 1;} NEON_ONE[vehicleid] = CreateObject(18650,0,0,0,0,0,0); NEON_TWO[vehicleid] = CreateObject(18650,0,0,0,0,0,0); AttachObjectToVehicle(NEON_ONE[vehicleid], vehicleid, -0.8, 0.0, -0.70, 0.0, 0.0, 0.0); AttachObjectToVehicle(NEON_TWO[vehicleid], vehicleid, 0.8, 0.0, -0.70, 0.0, 0.0, 0.0); NEON_COR[vehicleid] = "Yellow"; return 1; } case NEON_GREEN: { DestroyObject(NEON_ONE[vehicleid]); DestroyObject(NEON_TWO[vehicleid]); if(Bike(vehicleid)){NEON_ONE[vehicleid] = CreateObject(18649,0,0,0,0,0,0); AttachObjectToVehicle(NEON_ONE[vehicleid], vehicleid, 0.0, 0.0, -0.70, 0.0, 0.0, 0.0); NEON_TWO[vehicleid] = INVALID_OBJECT_ID; return 1;} NEON_ONE[vehicleid] = CreateObject(18649,0,0,0,0,0,0); NEON_TWO[vehicleid] = CreateObject(18649,0,0,0,0,0,0); AttachObjectToVehicle(NEON_ONE[vehicleid], vehicleid, -0.8, 0.0, -0.70, 0.0, 0.0, 0.0); AttachObjectToVehicle(NEON_TWO[vehicleid], vehicleid, 0.8, 0.0, -0.70, 0.0, 0.0, 0.0); NEON_COR[vehicleid] = "Green"; return 1; } case NEON_RED: { DestroyObject(NEON_ONE[vehicleid]); DestroyObject(NEON_TWO[vehicleid]); if(Bike(vehicleid)){NEON_ONE[vehicleid] = CreateObject(18647,0,0,0,0,0,0); AttachObjectToVehicle(NEON_ONE[vehicleid], vehicleid, 0.0, 0.0, -0.70, 0.0, 0.0, 0.0); NEON_TWO[vehicleid] = INVALID_OBJECT_ID; return 1;} NEON_ONE[vehicleid] = CreateObject(18647,0,0,0,0,0,0); NEON_TWO[vehicleid] = CreateObject(18647,0,0,0,0,0,0); AttachObjectToVehicle(NEON_ONE[vehicleid], vehicleid, -0.8, 0.0, -0.70, 0.0, 0.0, 0.0); AttachObjectToVehicle(NEON_TWO[vehicleid], vehicleid, 0.8, 0.0, -0.70, 0.0, 0.0, 0.0); NEON_COR[vehicleid] = "Red"; return 1; } case NEON_WHITE: { DestroyObject(NEON_ONE[vehicleid]); DestroyObject(NEON_TWO[vehicleid]); if(Bike(vehicleid)){NEON_ONE[vehicleid] = CreateObject(18652,0,0,0,0,0,0); AttachObjectToVehicle(NEON_ONE[vehicleid], vehicleid, 0.0, 0.0, -0.70, 0.0, 0.0, 0.0); NEON_TWO[vehicleid] = INVALID_OBJECT_ID; return 1;} NEON_ONE[vehicleid] = CreateObject(18652,0,0,0,0,0,0); NEON_TWO[vehicleid] = CreateObject(18652,0,0,0,0,0,0); AttachObjectToVehicle(NEON_ONE[vehicleid], vehicleid, -0.8, 0.0, -0.70, 0.0, 0.0, 0.0); AttachObjectToVehicle(NEON_TWO[vehicleid], vehicleid, 0.8, 0.0, -0.70, 0.0, 0.0, 0.0); NEON_COR[vehicleid] = "White"; return 1; } case NEON_POLICE: { if(Bike(vehicleid)){NEON_THR[vehicleid] = CreateObject(18646,0,0,0,0,0,0); AttachObjectToVehicle(NEON_THR[vehicleid], vehicleid, 0.014999, 0.724999, 0.669999, 0.0, 0.0, 0.0); return 1;} NEON_THR[vehicleid] = CreateObject(18646,0,0,0,0,0,0); AttachObjectToVehicle(NEON_THR[vehicleid], vehicleid, -0.5, -0.2, 0.8, 2.0, 2.0, 3.0); return 1; } default: { /*if(playerid != INVALID_PLAYER_ID) SendClientMessage(playerid, 0xA9C4E4FF, "Cor do neon invбlida.");*/ print("ERROR: Invalid neon color."); } } return 1; } stock RemoveNeonFromVehicle(vehicleid) { DestroyObject(NEON_ONE[vehicleid]); DestroyObject(NEON_TWO[vehicleid]); NEON_ONE[vehicleid] = INVALID_OBJECT_ID; NEON_TWO[vehicleid] = INVALID_OBJECT_ID; NEON_COR[vehicleid] = "None"; return 1; } /* ******************************** rLibrary - Radar Library ******************************** Descriзгo: Permite implantar radares de velocidade pela cidade. Quando um jogador passar pelo radar acima da velocidade, serб pego pelo radar. Versгo: 2.2 Developer: Luke "Larceny" G. ChangeLOG: 18/06/2011: Correзхes minimas. 30/12/2010: Novas funзхes de attach. 28/12/2010: Novas funзхes. 23/12/2010: Flash alternativo. Novo parвmetro na callback OnPlayerEnterRadar. 20/11/2010: Alteraзхes no Timer. 19/09/2010: CallBack OnPlayerEnterRadar agora retorna velocidade em que o jogador passou no radar. 18/09/2010: Primeira versгo Natives: native CreateRadar(Float:x, Float:y, Float:z, speedmax, radiacao, pickup, ativado, virtualword = -1); native DestroyRadar(lrid); native RadarExiste(lrid); native SetRadarPos(lrid, Float:x, Float:y, Float:z); native SetRadarVirtualWorld(lrid, virtualworld); native SetRadarAtivado(lrid, toggle); native SetRadarVelocidadeMax(lrid, velocidade); native SetRadarRadiacao(lrid, Float:radiacao); native SetRadarPickup(lrid, pickupid); native ObterRadarPos(lrid, &Float:x, &Float:y, &Float:z); native ObterRadarVirtualWorld(lrid); native LoadStaticRadarsFromFile(const filename[]); native GetPlayerSpeed(playerid, bool:velo); native GetVehicleSpeed(vehicleid); native AttachRadarToPlayer(playerid, velocidade); native DettachRadarToPlayer(playerid); native IsPlayerRadarAttached(playerid); */ #include "a_samp" #define MAX_Radar 100 #define LSR_TIME_CHECK 1500 #define ObterVelocidadeJogador GetPlayerSpeed #define ObterVelocidadeVeiculo GetVehicleSpeed enum lrdef { LSR_VW, LSR_OID, Float:LSR_X, Float:LSR_Y, Float:LSR_Z, LSR_speedmax, LSR_radiacao, LSR_pickup, LSR_ativado }; static LSR_Timer, LSR_Total, LSR_Radar[MAX_Radar][lrdef]; #define LSR_CheckTimerAd() if(!LSR_Timer) LSR_Timer = SetTimer("CheckRadar", LSR_TIME_CHECK, 1) #define LSR_CheckTimerRe() if(!LSR_Total){KillTimer(LSR_Timer); LSR_Timer = 0;} forward CheckRadar(); forward HideRadar(playerid); forward OnPlayerEnterRadar(playerid, speed, radarid); forward UseFlashRadar(); forward MoverPickup(lrid,Float:x,Float:y,Float:z); new Text:Flash; new bool:UseFlash; new bool:RadarAttached[MAX_PLAYERS]; new RadarAttachedSpeed[MAX_PLAYERS]; stock CreateRadar(Float:x, Float:y, Float:z, speedmax, radiacao, pickup, ativado, virtualword = -1) { new bid = LSR_ProcurarIDLivre(); if(bid == -1) { printf("[rLibrary:] Limite de radares exedido! (Max:%d) Adicione um valor no MAX_RADAR ou apague algum...", MAX_Radar); return 0; } LSR_Radar[bid][LSR_OID] = CreatePickup(pickup,1,x,y,z+2,-1); LSR_Radar[bid][LSR_X] = x; LSR_Radar[bid][LSR_Y] = y; LSR_Radar[bid][LSR_Z] = z; LSR_Radar[bid][LSR_speedmax] = speedmax; LSR_Radar[bid][LSR_VW] = virtualword; LSR_Radar[bid][LSR_radiacao] = radiacao; LSR_Radar[bid][LSR_pickup] = pickup; LSR_Radar[bid][LSR_ativado] = ativado; LSR_CheckTimerAd(); LSR_Total++; return bid; } stock DestroyRadar(lrid) { if(!LSR_Radar[lrid][LSR_OID]) return 0; LSR_Total--; DestroyPickup(LSR_Radar[lrid][LSR_pickup]); LSR_Radar[lrid][LSR_OID] = 0; LSR_CheckTimerRe() return 1; } stock RadarExiste(lrid) return (!LSR_Radar[lrid][LSR_OID]) ? 0 : 1; stock SetRadarPos(lrid, Float:x, Float:y, Float:z) { if(!LSR_Radar[lrid][LSR_OID]) return 0; LSR_Radar[lrid][LSR_X] = x; LSR_Radar[lrid][LSR_Y] = y; LSR_Radar[lrid][LSR_Z] = z; return MoverPickup(LSR_Radar[lrid][LSR_OID], x, y, z); } stock SetRadarAtivado(lrid, toggle) { if(!LSR_Radar[lrid][LSR_OID]) return 0; if(toggle == 1 || toggle == true){LSR_Radar[lrid][LSR_ativado] = 1;} if(toggle == 0 || toggle == false){LSR_Radar[lrid][LSR_ativado] = 0;} return MoverPickup(LSR_Radar[lrid][LSR_OID], x, y, z); } stock SetRadarVelocidadeMax(lrid, velocidade) { if(!LSR_Radar[lrid][LSR_OID]) return 0; return LSR_Radar[lrid][LSR_speedmax] = velocidade; } stock SetRadarRadiacao(lrid, Float:radiacao) { if(!LSR_Radar[lrid][LSR_OID]) return 0; return LSR_Radar[lrid][LSR_radiacao] = radiacao; } stock SetRadarPickup(lrid, pickupid) { if(!LSR_Radar[lrid][LSR_OID]) return 0; LSR_Radar[lrid][LSR_pickup] = pickupid; return MoverPickup(lrid, LSR_Radar[lrid][LSR_X], LSR_Radar[lrid][LSR_Y], LSR_Radar[lrid][LSR_Z]+2); } public MoverPickup(lrid,Float:x,Float:y,Float:z) { if(LSR_Radar[lrid][LSR_OID]) { DestroyPickup(LSR_Radar[lrid][LSR_OID]); LSR_Radar[lrid][LSR_X] = x; LSR_Radar[lrid][LSR_Y] = y; LSR_Radar[lrid][LSR_Z] = z; CreatePickup(LSR_Radar[lrid][LSR_pickup], 1, x, y, z, -1); return 1; } return 0; } stock SetRadarVirtualWorld(lrid, virtualworld) { if(!LSR_Radar[lrid][LSR_OID]) return 0; LSR_Radar[lrid][LSR_VW] = virtualworld; DestroyPickup(LSR_Radar[lrid][LSR_OID]); new x = LSR_Radar[lrid][LSR_X]; new y = LSR_Radar[lrid][LSR_Y]; new z = LSR_Radar[lrid][LSR_Z]; CreatePickup(LSR_Radar[lrid][LSR_pickup], 1, x, y, z, virtualworld); return 1; } stock ObterRadarPos(lrid, &Float:x, &Float:y, &Float:z) { if(!LSR_Radar[lrid][LSR_OID]) { x = 0.0; y = 0.0; z = 0.0; } x = LSR_Radar[lrid][LSR_X]; y = LSR_Radar[lrid][LSR_Y]; z = LSR_Radar[lrid][LSR_Z]; } stock ObterRadarVirtualWorld(lrid) { if(!LSR_Radar[lrid][LSR_OID]) return 0; return LSR_Radar[lrid][LSR_VW]; } public CheckRadar() { for(new i = 0; i < MAX_PLAYERS; i++) { if(RadarAttached[i] == true){RadarForPlayer(i, RadarAttachedSpeed[i], 999);} for(new b = 1; b <= LSR_Total; b++) { if(LSR_Radar[b][LSR_OID]) { if(LSR_Radar[b][LSR_ativado] == 1) { if(LSR_Radar[b][LSR_VW] == -1 || GetPlayerVirtualWorld(i) == LSR_Radar[b][LSR_VW]) { if(IsPlayerInRangeOfPoint(i, LSR_Radar[b][LSR_radiacao], LSR_Radar[b][LSR_X], LSR_Radar[b][LSR_Y], LSR_Radar[b][LSR_Z])) { if(GetPlayerState(i) == PLAYER_STATE_DRIVER) { RadarForPlayer(i, LSR_Radar[b][LSR_speedmax], LSR_Radar[b][LSR_OID]); } } } } } } } } stock LSR_ProcurarIDLivre() { for(new b = 1; b < MAX_Radar; b++) if(!LSR_Radar[b][LSR_OID]) return b; return -1; } stock GetPlayerSpeed(playerid, bool:velo) { new Float:Vx,Float:Vy,Float:Vz,Float:rtn; if(IsPlayerInAnyVehicle(playerid)) GetVehicleVelocity(GetPlayerVehicleID(playerid),Vx,Vy,Vz); else GetPlayerVelocity(playerid,Vx,Vy,Vz); rtn = floatsqroot(floatabs(floatpower(Vx + Vy + Vz,2))); return velo?floatround(rtn * 100 * 1.61):floatround(rtn * 100); } stock GetVehicleSpeed(vehicleid) { new Float:X, Float:Y, Float:Z; GetVehicleVelocity(vehicleid, X, Y, Z); return floatround(floatsqroot(X * X + Y * Y + Z * Z) * 180); } stock token_by_delim(const string[], return_str[], delim, start_index) { new x=0; while(string[start_index] != EOS && string[start_index] != delim) { return_str[x] = string[start_index]; x++; start_index++; } return_str[x] = EOS; if(string[start_index] == EOS) start_index = (-1); return start_index; } stock LoadStaticRadarsFromFile(const filename[]) { new File:file_ptr; new line[256]; new var_from_line[64]; new Float:SpawnX; new Float:SpawnY; new Float:SpawnZ; new SpeedMax; new Radiation, Pickup; new Ativado, VirtualWorld; new index; new radars_loaded; file_ptr = fopen(filename,filemode:io_read); if(!file_ptr) return 0; radars_loaded = 0; while(fread(file_ptr,line,256) > 0) { index = 0; // Read X, Y, Z, Rotation index = token_by_delim(line,var_from_line,',',index); if(index == (-1)) continue; SpawnX = floatstr(var_from_line); index = token_by_delim(line,var_from_line,',',index+1); if(index == (-1)) continue; SpawnY = floatstr(var_from_line); index = token_by_delim(line,var_from_line,',',index+1); if(index == (-1)) continue; SpawnZ = floatstr(var_from_line); // Read Speed Max index = token_by_delim(line,var_from_line,',',index+1); if(index == (-1)) continue; SpeedMax = strval(var_from_line); // Read Radiation, Pickup index = token_by_delim(line,var_from_line,',',index+1); if(index == (-1)) continue; Radiation = strval(var_from_line); index = token_by_delim(line,var_from_line,',',index+1); if(index == (-1)) continue; Pickup = strval(var_from_line); //Read Ativado, VirtualWorld index = token_by_delim(line,var_from_line,',',index+1); if(index == (-1)) continue; Ativado = strval(var_from_line); index = token_by_delim(line,var_from_line,';',index+1); VirtualWorld = strval(var_from_line); CreateRadar(SpawnX, SpawnY, SpawnZ, SpeedMax, Radiation, Pickup, Ativado, VirtualWorld); radars_loaded++; } fclose(file_ptr); printf("[rLibrary:] %d Radares carregados do arquivo: %s",radars_loaded,filename); return radars_loaded; } stock AttachRadarToPlayer(playerid, velocidade) { RadarAttached[playerid] = true; RadarAttachedSpeed[playerid] = velocidade; return 1; } stock DettachRadarToPlayer(playerid) { RadarAttached[playerid] = false; RadarAttachedSpeed[playerid] = 0; return 1; } stock IsPlayerRadarAttached(playerid) { if(RadarAttached[playerid] == true) return true; return false; } stock RadarForPlayer(playerid, speedlimit, radarid) { new currentspeed = GetPlayerSpeed(playerid, true); if(currentspeed >= speedlimit) { if(UseFlash == true){TextDrawShowForPlayer(playerid, Flash); SetTimerEx("HideRadar", 1000, 0, "d", playerid);} PlayerPlaySound(playerid,1132,0.0,0.0,0.0); OnPlayerEnterRadar(playerid, currentspeed, radarid); } return 1; } forward LSR_PlayerConnect(playerid); public LSR_PlayerConnect(playerid) { RadarAttached[playerid] = false; RadarAttachedSpeed[playerid] = 0; return 1; } public HideRadar(playerid) { TextDrawHideForPlayer(playerid, Flash); return 1; } public UseFlashRadar() { UseFlash = true; Flash = TextDrawCreate(635.000000, 432.000000, "__"); TextDrawBackgroundColor(Flash, 255); TextDrawFont(Flash, 1); TextDrawLetterSize(Flash, 0.500000, -45.900001); TextDrawColor(Flash, -256); TextDrawSetOutline(Flash, 0); TextDrawSetProportional(Flash, 1); TextDrawSetShadow(Flash, 1); TextDrawUseBox(Flash, 1); TextDrawBoxColor(Flash, -86); TextDrawTextSize(Flash, 6.000000, 35.000000); return 1; }