Ez a szekció lehetővé teszi a felhasználó által írt összes hozzászólás megtekintését. Vedd figyelembe, hogy csak azokba a fórumokba írt hozzászólásokat látod, amelyekhez hozzáférésed van. 1816
Segítségkérés / Admin TGF« Dátum: 2012. január 26. - 15:58:59 »Idézetet írta: Flash date=1327586755\" data-ipsquote-contentapp=\"forums\" data-ipsquote-contenttype=\"forums\" data-ipsquote-contentid=\"15881\" data-ipsquote-contentclass=\"forums_Topic Már bocsáss meg, de én nem ugyan ezt írtam?public OnPlayerCommandText(playerid, cmdtext[]) 1817
Segítségkérés / Segitség[trafi]Textdraw error« Dátum: 2012. január 26. - 14:24:04 »
Tessék:
[pawn] /* gCamera - Speedcamera in SA-MP WITH FLASH EFFECT! V1.1 - Released on 10-04-2011 (Updated at 12-04-2011) Filterscript version with ingame speedcam generator! Gamer931215 I want to thank my friend HighFlyer in this release for some tips and testing it (like textlabels, using a streamer, etc) ! Use at own risk, do NOT re-release,mirror,sell it or even worse: clame this as your own! */ #include <a_samp> #include <zcmd> #include <YSI/y_ini> //=================================================================================================== // Settings //=================================================================================================== // SETTING: VALUE: Discription: #define CAMERA_LIMIT 100 //Max loaded cameras (keep this as low as possible for the best performance) #define CAMERA_UPDATE_INTERVAL 750 //update interval of all speedcams (in miliseconds) #define CAMERA_FLASH_TIME 1200 //ammount of miliseconds until the \"flash\" effect gets removed again #define CAMERA_DIALOG_RANGE 1337 //dialog ID range (Example: 0 will take dialogid\'s 0 - 9) #define CAMERA_USEMPH 0 //toggles camera using mph by default (0=kmh, 1=mph) #define CAMERA_LABEL_COLOR 0xFF000FFF //The default color of the camera\'s label #define CAMERA_PERSPECTIVE false //Sets playercamera temporary at the camera\'s position while flashing //streamer options (will be used if STREAMER_ENABLED is set on true) #define STREAMER_ENABLED false //uses a streamer (true/false) #define STREAMER_ADD CreateDynamicObject //put here at the value the command your streamer uses to make an object (CreateDynamicObject by default) #define STREAMER_REMOVE DestroyDynamicObject //put here at the value the command your streamer uses to remove an object (STREAMER_REMOVE by default) #if STREAMER_ENABLED == true //ignore this line #include streamer //put your include name here #endif //ignore this line //=================================================================================================== // Variables //=================================================================================================== #define DIALOG_MAIN CAMERA_DIALOG_RANGE #define DIALOG_RANGE CAMERA_DIALOG_RANGE +1 #define DIALOG_LIMIT CAMERA_DIALOG_RANGE +2 #define DIALOG_FINE CAMERA_DIALOG_RANGE +3 #define DIALOG_EDIT CAMERA_DIALOG_RANGE +4 #define DIALOG_EANGLE CAMERA_DIALOG_RANGE +5 #define DIALOG_ELIMIT CAMERA_DIALOG_RANGE +6 #define DIALOG_ERANGE CAMERA_DIALOG_RANGE +7 #define DIALOG_EFINE CAMERA_DIALOG_RANGE +8 #define DIALOG_ETYPE CAMERA_DIALOG_RANGE +9 #define DIALOG_LABEL CAMERA_DIALOG_RANGE +10 #define COLOR_RED 0xFF1E00FF #define COLOR_GREEN 0x05FF00FF enum _camera {Float:_x,Float:_y,Float:_z,Float:_rot,_range,_limit,_fine,_usemph,_objectid,bool:_active,bool:_activelabel,_labeltxt[128],Text3D:_label} new SpeedCameras[CAMERA_LIMIT][_camera],loaded_cameras = 0,Text:flash; //stocks for attaching labels to camera (must be defined before use, thats why this one is at the top) stock Text3D:AttachLabelToCamera(cameraid,text[]) { new position,buffer[128];format(buffer,sizeof buffer,\"%s\",text); for(new i = 0;strfind(buffer,\"\\\\n\",true) != -1;i++) { position = strfind(buffer,\"\\\\n\",true); strdel(buffer,position,position +2); strins(buffer,\"\\r\\n\",position,sizeof(buffer)); } return Create3DTextLabel(buffer,CAMERA_LABEL_COLOR,SpeedCameras[cameraid][_x],SpeedCameras[cameraid][_y],SpeedCameras[cameraid][_z] +7,100,0,0); } stock UpdateCameraLabel(Text3D:labelid,text[]) { new position,buffer[128];format(buffer,sizeof buffer,\"%s\",text); for(new i = 0;strfind(buffer,\"\\\\n\",true) != -1;i++) { position = strfind(buffer,\"\\\\n\",true); strdel(buffer,position,position +2); strins(buffer,\"\\r\\n\",position,sizeof(buffer)); } return Update3DTextLabelText(labelid,CAMERA_LABEL_COLOR,buffer); } //=================================================================================================== // Initialize //=================================================================================================== public OnFilterScriptInit() { SetTimer(\"UpdateCameras\",CAMERA_UPDATE_INTERVAL,true); print(\"====================================\"); print(\"| gCamera V1.0 |\"); print(\"| Gamer931215 |\"); print(\"====================================\"); print(\"Initializing...\"); LoadCameras(); return 1; } public OnFilterScriptExit() { print(\"====================================\"); print(\"| gCamera V1.0 |\"); print(\"| Gamer931215 |\"); print(\"====================================\"); RemoveCameras(); print(\"All cameras have been removed.\"); return 1; } //=================================================================================================== // Commands //=================================================================================================== COMMAND:gcam(playerid,params[]) { if(!IsPlayerAdmin(playerid)) return 0; ShowPlayerDialog(playerid,DIALOG_MAIN,DIALOG_STYLE_LIST,\"{00A5FF}gCamera {FFFFFF}- {FFDC00}Main menu\",\"{37FF00}Create speedcamera\\n\\nGet closest speedcamera ID\\nEdit closest speedcamera\\n{FF1400}Delete closest speedcamera\\n{FF1400}Delete all speedcameras\",\"OK\",\"Cancel\"); return 1; } //=================================================================================================== // Callbacks //=================================================================================================== public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if(!response) { DeletePVar(playerid,\"range\"); DeletePVar(playerid,\"limit\"); DeletePVar(playerid,\"fine\"); DeletePVar(playerid,\"selected\"); return 1; } switch(dialogid) { //====================================================== // Main menu //====================================================== case DIALOG_MAIN: { switch(listitem) { case 0: ShowPlayerDialog(playerid,DIALOG_RANGE,DIALOG_STYLE_INPUT,\"Insert a range\",\"Please insert a range (recommended: 20-30)\",\"OK\",\"Cancel\"); case 1: { new cam = GetClosestCamera(playerid); if(cam == -1) return SendClientMessage(playerid,COLOR_RED,\"No nearby cameras found!\"); SendClientMessageEx(playerid,COLOR_GREEN,\"sis\",\"The closest cameraID is ID: \",cam,\".\"); } case 2: { new cam = GetClosestCamera(playerid); if(cam == -1) return SendClientMessage(playerid,COLOR_RED,\"No nearby cameras found!\"); SetPVarInt(playerid,\"selected\",cam); ShowPlayerDialog(playerid,DIALOG_EDIT,DIALOG_STYLE_LIST,\"{00A5FF}gCamera {FFFFFF}- {FFDC00}Editor\",\"Change angle\\nChange range\\nChange speedlimit\\nChange fine\\nToggle mph mode\\nAdd/Remove/Edit textlabel\\n{FF1400}Delete camera\",\"OK\",\"Cancel\"); } case 3: { new cam = GetClosestCamera(playerid); if(cam == -1) return SendClientMessage(playerid,COLOR_RED,\"No nearby cameras found!\"); DestroySpeedCam(cam); SendClientMessage(playerid,COLOR_GREEN,\"Camera has been removed.\"); DeletePVar(playerid,\"selected\"); } case 4: { for(new i = 0;i<loaded_cameras +1;i++) { if(SpeedCameras[_active] == true) { DestroySpeedCam(i); } } SendClientMessage(playerid,COLOR_GREEN,\"All speedcameras have been removed.\"); } } } //====================================================== // Making a speedcam //====================================================== case DIALOG_RANGE: { if(!strlen(inputtext)) return ShowPlayerDialog(playerid,DIALOG_RANGE,DIALOG_STYLE_INPUT,\"Insert a range\",\"Please insert a range (recommended: 20-30)\",\"OK\",\"Cancel\"); SetPVarInt(playerid,\"range\",strval(inputtext)); ShowPlayerDialog(playerid,DIALOG_LIMIT,DIALOG_STYLE_INPUT,\"Insert a speedlimit\",\"Please insert a speedlimit\",\"OK\",\"Cancel\"); } case DIALOG_LIMIT: { if(!strlen(inputtext)) return ShowPlayerDialog(playerid,DIALOG_LIMIT,DIALOG_STYLE_INPUT,\"Insert a speedlimit\",\"Please insert a speedlimit\",\"OK\",\"Cancel\"); SetPVarInt(playerid,\"limit\",strval(inputtext)); ShowPlayerDialog(playerid,DIALOG_FINE,DIALOG_STYLE_INPUT,\"Insert a fine\",\"Please insert a fine\",\"OK\",\"Cancel\"); } case DIALOG_FINE: { if(!strlen(inputtext)) return ShowPlayerDialog(playerid,DIALOG_FINE,DIALOG_STYLE_INPUT,\"Insert a fine\",\"Please insert a fine\",\"OK\",\"Cancel\"); SetPVarInt(playerid,\"fine\",strval(inputtext)); new Float:x,Float:y,Float:z,Float:angle; GetPlayerPos(playerid,x,y,z);GetPlayerFacingAngle(playerid,angle); angle = angle + 180;if(angle > 360){angle = angle - 360;} new id = CreateSpeedCam(x,y,z -3,angle,GetPVarInt(playerid,\"range\"),GetPVarInt(playerid,\"limit\"),GetPVarInt(playerid,\"fine\"),CAMERA_USEMPH); SetPlayerPos(playerid,x,y+2,z); DeletePVar(playerid,\"range\"); DeletePVar(playerid,\"limit\"); DeletePVar(playerid,\"fine\"); SetPVarInt(playerid,\"selected\",id); ShowPlayerDialog(playerid,DIALOG_EDIT,DIALOG_STYLE_LIST,\"{00A5FF}gCamera {FFFFFF}- {FFDC00}Editor\",\"Change angle\\nChange range\\nChange speedlimit\\nChange fine\\nToggle mph mode\\nAdd/Remove/Edit textlabel\\n{FF1400}Delete camera\",\"OK\",\"Cancel\"); } //====================================================== // Edit menu //====================================================== case DIALOG_EDIT: { switch(listitem) { case 0: ShowPlayerDialog(playerid,DIALOG_EANGLE,DIALOG_STYLE_INPUT,\"{00A5FF}gCamera {FFFFFF}- {FFDC00}Editor - Angle\",\"Please enter a new angle\",\"OK\",\"Cancel\"); case 1: ShowPlayerDialog(playerid,DIALOG_ERANGE,DIALOG_STYLE_INPUT,\"{00A5FF}gCamera {FFFFFF}- {FFDC00}Editor - Range\",\"Please enter a new range\",\"OK\",\"Cancel\"); case 2: ShowPlayerDialog(playerid,DIALOG_ELIMIT,DIALOG_STYLE_INPUT,\"{00A5FF}gCamera {FFFFFF}- {FFDC00}Editor - Speedlimit\",\"Please enter a new speedlimit\",\"OK\",\"Cancel\"); case 3: ShowPlayerDialog(playerid,DIALOG_EFINE,DIALOG_STYLE_INPUT,\"{00A5FF}gCamera {FFFFFF}- {FFDC00}Editor - Fine\",\"Please enter a new fine\",\"OK\",\"Cancel\"); case 4: ShowPlayerDialog(playerid,DIALOG_ETYPE,DIALOG_STYLE_INPUT,\"{00A5FF}gCamera {FFFFFF}- {FFDC00}Editor - Mph/Kmh\",\"enter 1 to use mph and 0 for kmh\",\"OK\",\"Cancel\"); case 5: ShowPlayerDialog(playerid,DIALOG_LABEL,DIALOG_STYLE_INPUT,\"{00A5FF}gCamera {FFFFFF}- {FFDC00}Editor - Textlabel\",\"Please fill in the text you want to attach, or leave it empty to remove an existing label!\",\"OK\",\"Cancel\"); case 6: { DestroySpeedCam(GetPVarInt(playerid,\"selected\")); SendClientMessage(playerid,COLOR_GREEN,\"Camera has been removed.\"); DeletePVar(playerid,\"selected\"); } } } //====================================================== // Editing a speedcam //====================================================== case DIALOG_EANGLE: { if(!strlen(inputtext)) return ShowPlayerDialog(playerid,DIALOG_EANGLE,DIALOG_STYLE_INPUT,\"{00A5FF}gCamera {FFFFFF}- {FFDC00}Editor - Angle\",\"Please enter a new angle\",\"OK\",\"Cancel\"); new id = GetPVarInt(playerid,\"selected\"); new rot = strval(inputtext); rot = rot + 180; if (rot > 360) { rot = rot - 360; } SpeedCameras[id][_rot] = rot; SetObjectRot(SpeedCameras[id][_objectid],0,0,rot); SaveCamera(id); SendClientMessageEx(playerid,COLOR_GREEN,\"sisis\",\"The angle of cameraID \",id,\" has succesfully been updated to \",strval(inputtext),\".\"); } case DIALOG_ERANGE: { if(!strlen(inputtext)) return ShowPlayerDialog(playerid,DIALOG_ERANGE,DIALOG_STYLE_INPUT,\"{00A5FF}gCamera {FFFFFF}- {FFDC00}Editor - Range\",\"Please enter a new range\",\"OK\",\"Cancel\"); new id = GetPVarInt(playerid,\"selected\"); SpeedCameras[id][_range] = strval(inputtext); SaveCamera(id); SendClientMessageEx(playerid,COLOR_GREEN,\"sisis\",\"The range of cameraID \",id,\" has succesfully been updated to \",strval(inputtext),\".\"); } case DIALOG_ELIMIT: { if(!strlen(inputtext)) return ShowPlayerDialog(playerid,DIALOG_ELIMIT,DIALOG_STYLE_INPUT,\"{00A5FF}gCamera {FFFFFF}- {FFDC00}Editor - Speedlimit\",\"Please enter a new Speedlimit\",\"OK\",\"Cancel\"); new id = GetPVarInt(playerid,\"selected\"); SpeedCameras[id][_limit] = strval(inputtext); SaveCamera(id); SendClientMessageEx(playerid,COLOR_GREEN,\"sisis\",\"The speedlimit of cameraID \",id,\" has succesfully been updated to \",strval(inputtext),\".\"); } case DIALOG_EFINE: { if(!strlen(inputtext)) return ShowPlayerDialog(playerid,DIALOG_EFINE,DIALOG_STYLE_INPUT,\"{00A5FF}gCamera {FFFFFF}- {FFDC00}Editor - Fine\",\"Please enter a new fine\",\"OK\",\"Cancel\"); new id = GetPVarInt(playerid,\"selected\"); SpeedCameras[id][_fine] = strval(inputtext); SaveCamera(id); SendClientMessageEx(playerid,COLOR_GREEN,\"sisis\",\"The fine of cameraID \",GetPVarInt(playerid,\"selected\"),\" has succesfully been updated to \",strval(inputtext),\".\"); } case DIALOG_ETYPE: { if(!strlen(inputtext) || strval(inputtext) != 0 && strval(inputtext) != 1) return ShowPlayerDialog(playerid,DIALOG_ETYPE,DIALOG_STYLE_INPUT,\"{00A5FF}gCamera {FFFFFF}- {FFDC00}Editor - Mph/Kmh\",\"enter 1 to use mph and 0 for kmh\",\"OK\",\"Cancel\"); new id = GetPVarInt(playerid,\"selected\"); SpeedCameras[id][_usemph] = strval(inputtext); if(strval(inputtext) == 1) { SendClientMessageEx(playerid,COLOR_GREEN,\"sis\",\"CameraID \",GetPVarInt(playerid,\"selected\"),\" does now meassure speed in mph.\"); } else { SendClientMessageEx(playerid,COLOR_GREEN,\"sis\",\"CameraID \",GetPVarInt(playerid,\"selected\"),\" does now meassure speed in kmh.\"); } } case DIALOG_LABEL: { new id = GetPVarInt(playerid,\"selected\"); if(!strlen(inputtext)) { if(SpeedCameras[id][_activelabel] == true) { Delete3DTextLabel(SpeedCameras[id][_label]); SpeedCameras[id][_activelabel] = false; SpeedCameras[id][_labeltxt] = 0; } SendClientMessageEx(playerid,COLOR_GREEN,\"sis\",\"The textlabel of cameraID \",GetPVarInt(playerid,\"selected\"),\" has succesfully been removed.\"); } else { if(SpeedCameras[id][_activelabel] == true) { format(SpeedCameras[id][_labeltxt],128,\"%s\",inputtext); UpdateCameraLabel(SpeedCameras[id][_label],inputtext); } else { SpeedCameras[id][_activelabel] = true; format(SpeedCameras[id][_labeltxt],128,\"%s\",inputtext); SpeedCameras[id][_label] = AttachLabelToCamera(id,inputtext); } SendClientMessageEx(playerid,COLOR_GREEN,\"sisss\",\"The textlabel of cameraID \",GetPVarInt(playerid,\"selected\"),\" has succesfully been updated to \",inputtext,\".\"); } SaveCamera(id); } } return 0; } //=================================================================================================== // Functions //=================================================================================================== stock LoadCameras() { new file[64]; for(new i = 0;i<CAMERA_LIMIT;i++) { format(file,sizeof file,\"/SpeedCameras/%i.txt\",i); if(fexist(file)) { INI_ParseFile(file,\"LoadCam\",.bExtra = true,.extra = i); #if STREAMER_ENABLED == true SpeedCameras[_objectid] = STREAMER_ADD(18880,SpeedCameras[_x],SpeedCameras[_y],SpeedCameras[_z],0,0,SpeedCameras[_rot]); #else SpeedCameras[_objectid] = CreateObject(18880,SpeedCameras[_x],SpeedCameras[_y],SpeedCameras[_z],0,0,SpeedCameras[_rot]); #endif SpeedCameras[_active] = true; if(SpeedCameras[_activelabel] == true) { SpeedCameras[_label] = AttachLabelToCamera(i,SpeedCameras[_labeltxt]); } loaded_cameras++; } } printf(\"gCamera has succesfully loaded %i camera(s).\",loaded_cameras); } forward LoadCam(cameraid,name[],value[]); public LoadCam(cameraid,name[],value[]) { INI_Float(\"_x\",SpeedCameras[cameraid][_x]); INI_Float(\"_y\",SpeedCameras[cameraid][_y]); INI_Float(\"_z\",SpeedCameras[cameraid][_z]); INI_Float(\"_rot\",SpeedCameras[cameraid][_rot]); INI_Int(\"_range\",SpeedCameras[cameraid][_range]); INI_Int(\"_limit\",SpeedCameras[cameraid][_limit]); INI_Int(\"_fine\",SpeedCameras[cameraid][_fine]); INI_Int(\"_usemph\",SpeedCameras[cameraid][_usemph]); INI_Bool(\"_activelabel\",SpeedCameras[cameraid][_activelabel]); INI_String(\"_labeltxt\",SpeedCameras[cameraid][_labeltxt],128); return 1; } stock RemoveCameras() { for(new i = 0;i<loaded_cameras +1;i++) { if(SpeedCameras[_active] == true) { #if STREAMER_ENABLED == true STREAMER_REMOVE(SpeedCameras[_objectid]); #else DestroyObject(SpeedCameras[_objectid]); #endif if(SpeedCameras[_activelabel] == true) { Delete3DTextLabel(SpeedCameras[_label]); } } } return 1; } stock generate_id() { new file[64]; for(new i = 0;i<CAMERA_LIMIT;i++) { format(file,sizeof file,\"/SpeedCameras/%i.txt\",i); if(!fexist(file)) return i; } return -1; } stock CreateSpeedCam(Float:x,Float:y,Float:z,Float:rot,range,limit,fine,use_mph = 0) { new newid = generate_id(); if(newid == -1) { print(\"gSpeedcam: ERROR! Cannot create speedcam, max ammount of speedcameras has been reached!\"); return 1; } if (newid == loaded_cameras || newid > loaded_cameras) { loaded_cameras++; } SpeedCameras[newid][_x] = x; SpeedCameras[newid][_y] = y; SpeedCameras[newid][_z] = z; SpeedCameras[newid][_rot] = rot; SpeedCameras[newid][_range] = range; SpeedCameras[newid][_limit] = limit; SpeedCameras[newid][_fine] = fine; SpeedCameras[newid][_usemph] = use_mph; #if STREAMER_ENABLED == true SpeedCameras[newid][_objectid] = STREAMER_ADD(18880,x,y,z,0,0,rot); #else SpeedCameras[newid][_objectid] = CreateObject(18880,x,y,z,0,0,rot); #endif SpeedCameras[newid][_active] = true; SpeedCameras[newid][_activelabel] = false; SpeedCameras[newid][_labeltxt] = 0; new file[64];format(file,sizeof file,\"/SpeedCameras/%i.txt\",newid); new INI:handler = INI_Open(file); INI_WriteFloat(handler,\"_x\",SpeedCameras[newid][_x]); INI_WriteFloat(handler,\"_y\",SpeedCameras[newid][_y]); INI_WriteFloat(handler,\"_z\",SpeedCameras[newid][_z]); INI_WriteFloat(handler,\"_rot\",SpeedCameras[newid][_rot]); INI_WriteInt(handler,\"_range\",SpeedCameras[newid][_range]); INI_WriteInt(handler,\"_limit\",SpeedCameras[newid][_limit]); INI_WriteInt(handler,\"_fine\",SpeedCameras[newid][_fine]); INI_WriteInt(handler,\"_usemph\",SpeedCameras[newid][_usemph]); INI_WriteBool(handler,\"_activelabel\",SpeedCameras[newid][_activelabel]); INI_WriteString(handler,\"_labeltxt\",SpeedCameras[newid][_labeltxt]); INI_Close(handler); return newid; } stock SaveCamera(cameraid) { new file[64];format(file,sizeof file,\"/SpeedCameras/%i.txt\",cameraid); new INI:handler = INI_Open(file); INI_WriteFloat(handler,\"_x\",SpeedCameras[cameraid][_x]); INI_WriteFloat(handler,\"_y\",SpeedCameras[cameraid][_y]); INI_WriteFloat(handler,\"_z\",SpeedCameras[cameraid][_z]); INI_WriteFloat(handler,\"_rot\",SpeedCameras[cameraid][_rot]); INI_WriteInt(handler,\"_range\",SpeedCameras[cameraid][_range]); INI_WriteInt(handler,\"_limit\",SpeedCameras[cameraid][_limit]); INI_WriteInt(handler,\"_fine\",SpeedCameras[cameraid][_fine]); INI_WriteInt(handler,\"_usemph\",SpeedCameras[cameraid][_usemph]); INI_WriteBool(handler,\"_activelabel\",SpeedCameras[cameraid][_activelabel]); INI_WriteString(handler,\"_labeltxt\",SpeedCameras[cameraid][_labeltxt]); INI_Close(handler); } stock DestroySpeedCam(cameraid) { SpeedCameras[cameraid][_active] = false; #if STREAMER_ENABLED == true STREAMER_REMOVE(SpeedCameras[cameraid][_objectid]); #else DestroyObject(SpeedCameras[cameraid][_objectid]); #endif if(SpeedCameras[cameraid][_activelabel] == true) { Delete3DTextLabel(SpeedCameras[cameraid][_label]); } SpeedCameras[cameraid][_activelabel] = false; SpeedCameras[cameraid][_labeltxt] = 0; new file[64];format(file,sizeof file,\"/SpeedCameras/%i.txt\",cameraid); if(fexist(file)){fremove(file);} return 1; } stock SetSpeedCamRange(cameraid,limit) { SpeedCameras[cameraid][_limit] = limit; return 1; } stock SetSpeedCamFine(cameraid,fine) { SpeedCameras[cameraid][_fine] = fine; return 1; } stock Float:GetDistanceBetweenPoints(Float:x,Float:y,Float:tx,Float:ty) { new Float:temp1, Float:temp2; temp1 = x-tx;temp2 = y-ty; return floatsqroot(temp1*temp1+temp2*temp2); } stock GetClosestCamera(playerid) { new Float:distance = 10,Float:temp,Float:x,Float:y,Float:z,current = -1;GetPlayerPos(playerid,x,y,z); for(new i = 0;i<loaded_cameras +1;i++) { if(SpeedCameras[_active] == true) { temp = GetDistanceBetweenPoints(x,y,SpeedCameras[_x],SpeedCameras[_y]); if(temp < distance) { distance = temp; current = i; } } } return current; } stock Float:GetVehicleSpeed(vehicleid,UseMPH = 0) { new Float:speed_x,Float:speed_y,Float:speed_z,Float:temp_speed; GetVehicleVelocity(vehicleid,speed_x,speed_y,speed_z); if(UseMPH == 0) { temp_speed = floatsqroot(((speed_x*speed_x)+(speed_y*speed_y))+(speed_z*speed_z))*136.666667; } else { temp_speed = floatsqroot(((speed_x*speed_x)+(speed_y*speed_y))+(speed_z*speed_z))*85.4166672; } floatround(temp_speed,floatround_round);return temp_speed; } stock SendClientMessageEx(playerid,color,type[],{Float,_}:...) { new string[128]; for(new i = 0;i<numargs() -2;i++) { switch(type) { case 's\': { new result[128]; for(new a= 0;getarg(i +3,a) != 0;a++) { result[a] = getarg(i +3,a); } if(!strlen(string)) { format(string,sizeof string,\"%s\",result); } else format(string,sizeof string,\"%s%s\",string,result); } case 'i\': { new result = getarg(i +3); if(!strlen(string)) { format(string,sizeof string,\"%i\",result); } else format(string,sizeof string,\"%s%i\",string,result); } case 'f\': { 1818
Segítségkérés / Admin TGF« Dátum: 2012. január 26. - 14:20:11 »
Így:
[pawn]public OnPlayerCommandText(playerid, cmdtext[]) { if(strcmp(cmd,\"/tgf\",true) == 0) { SendClientMessage(playerid, COLOR_WHITE,\"TGF: (írd ide,hogy van-e vagy nincs)\"); return 1; } return 0; } [/pawn] cmdtext[] helyére cmdtext[] -et írj 1819
Szkript kérések / Kapu Script« Dátum: 2012. január 25. - 14:29:08 »
Küld el pü ben a modot/scriptet és megcsinálom!
Dupla hozzászólás automatikusan összefûzve. ( 2012. január 26. - 14:33:36 ) Elvileg így mûködnie kell, ha nem tudod belerakni a módba, akkor csak illeszd bele egy új scriptbe!! [pawn] #include <a_samp> #include zcmd new kapu; public OnGameModeInit() { kapu = CreateObject(3095, 214.10000610352, 1875.4000244141, 11.89999961853, 270, 0, 0); return 1; } CMD:zar(playerid, params[]) { MoveObject(kapu, 940.599609375, 2543.3994140625, 12.60000038147 , 2.0); return 1; } CMD:nyit(playerid, params[]) { MoveObject(kapu, 951.59997558594, 2539.3999023438, 12.60000038147 , 2.0); return 1; } [/pawn] 1820
SA-MP: Szerverfejlesztés / Rp« Dátum: 2012. január 24. - 21:32:40 »
Széép! Rp szerverekhez nagyon jó szerintem.
Ajánlom figyelmedbe: www.kep-host.tk (Remélem nem gond hogy kiírtam, ha mégis bocsi, szóljatok) 1821
Szkript kérések / Kapu Script« Dátum: 2012. január 24. - 21:12:10 »
Esetleg így:
[pawn] kapu = CreateObject(3095, 214.10000610352, 1875.4000244141, 11.89999961853, 270, 0, 0); // ide a saját objectedet írd public OnPlayerCommandText(playerid, cmdtext[]); { if(strcmp(cmdtext, \"/zar\", true) == 0) { MoveObject(kapu, 940.599609375, 2543.3994140625, 12.60000038147 , 2.0); return 1; } if(strcmp(cmdtext, \"/nyit\", true) == 0) { MoveObject(kapu, 951.59997558594, 2539.3999023438, 12.60000038147 , 2.0); return 1; } return 0; } [/pawn] Ezt: cmdtext[] cseréld ki erre: []); mert nem jól jeleníti meg a fórum! 1822
Szkript kérések / Beszélõ npc« Dátum: 2012. január 24. - 21:02:52 »
Ötletem:
Katt: http://translate.google.hu/ Írd be a szöveget, mondasd ki vele, vedd fel goldwave programmal, lekéred hogy a közelében van e és ha igen akkor: [pawn]PlayAudioStreamForPlayer(playerid, \"http://www.valami.valami/beszed1.mp3\", X, Y, Z, Hatótávolság, 1);[/pawn] 1823
Segítségkérés / Csak én tudok felmenni.« Dátum: 2012. január 23. - 15:50:00 »Idézetet írta: Zalakaka45 date=1327245533\" data-ipsquote-contentapp=\"forums\" data-ipsquote-contenttype=\"forums\" data-ipsquote-contentid=\"15929\" data-ipsquote-contentclass=\"forums_Topic nekem igy néz kiAmúgy az announnce-t megéri át írni 1re, ha akarod hogy a szerverlistában megtalálják a szerveredet. Nyiss portot a modemben/routerben! (Jelen esetben 7777) 1824
SA-MP: Szerverfejlesztés / Sprites Editor by Zh3r0« Dátum: 2012. január 22. - 12:50:15 »Idézetet írta: ~ Metaxa ™ date=1327230159\" data-ipsquote-contentapp=\"forums\" data-ipsquote-contenttype=\"forums\" data-ipsquote-contentid=\"15499\" data-ipsquote-contentclass=\"forums_Topic hogy tudok saját képet berakni? xDEz engem is érdekelne! 1825
Archívum / Civilek És Rendõrök [0.3d]« Dátum: 2012. január 21. - 22:44:48 »Idézetet írta: GaMeR date=1327175858\" data-ipsquote-contentapp=\"forums\" data-ipsquote-contenttype=\"forums\" data-ipsquote-contentid=\"14888\" data-ipsquote-contentclass=\"forums_Topic Tetszik a weboldal, meg a szerver is, ezzel semmi bajom!Köszönöm hogy szóltál! Sajnos a szétpakolt kocsikkal nem tudok mit csinálni, de most beállítom úgy hogy 2 perc után autómatikusan respawnolódjanak vissza a helyükre! A felfordulással egyenlõre nem tudok semmit se csinálni, csak annyit, hogy veszek fel több rendõrt, és megpróbálok velük rendet tetetni! A káromkodásért elnézésedet kérem! Lehet kevered az adminokat a rendõrökkel, aki [CESR] elõtaggal van ellátva az rendõr! Tehát próbálom a szervert helyrehozni. További jó szórakozást kívánok a szerveren ha még játszol. Köszönöm az értékelés! 1826
Törölt RP Szerverek / [HUN] RockStaR\'S RPG - Ahol élményekkel teli dús jövõ vár rád!« Dátum: 2012. január 21. - 14:37:31 »Idézetet írta: ChuckNorris date=1327149036\" data-ipsquote-contentapp=\"forums\" data-ipsquote-contenttype=\"forums\" data-ipsquote-contentid=\"15890\" data-ipsquote-contentclass=\"forums_Topic Esküszöm most már ugyan úgy fogalmazni mint egy másik RP szerver? Azta hogy kimásolta a mondat elsõ 5 szavát,mennyire megérte,õ nem tudta volna leírni igaz? Bizonyára tényleg ebbõl le lehet következtetni hogy az egész copy igaz?...... 1827
Segítségkérés / SetTimer Hiba« Dátum: 2012. január 20. - 23:15:50 »
Már SetTimerExel is próbáltam, de lehet megtaláltam a megoldást a tutorialban! Köszi a linket ha segített, ha nem!!
Egyenlõre nem tudom megcsinálni amit akartam mert lefagyott a gépem :mistrust: 1828
Segítségkérés / SetTimer Hiba« Dátum: 2012. január 20. - 23:02:01 »
Sziasztok! Kezd már nagyon felbosszantani, nem tudok rájönni miért csak id 0nak van fizetés.
Itt a timer: OnPlayerConnect alatt: [pawn]SetTimer(\"fizetes\", 10*1000, false);[/pawn] Király lenne ha valaki tudná a megoldást! Kössz! 1829
Archívum / Civilek És Rendõrök [0.3d]« Dátum: 2012. január 18. - 16:37:29 »Idézetet írta: ~ Metaxa ™ date=1326891759\" data-ipsquote-contentapp=\"forums\" data-ipsquote-contenttype=\"forums\" data-ipsquote-contentid=\"14888\" data-ipsquote-contentclass=\"forums_Topic Felmentem, le spawnolt 4 sárkány kaszinóhoz, miközbe irogattam belementem a pickupba (rablás) és el akartak kapni, az a predator gyerek le DB-zett, majd motorról megbilincselt, jött a társa hunterrel és lecsukott XDA drive by nem tiltott! \"belementem a pickupba\" Attól kiválaszthattad volna a \"Nem\" et A predator gyereket meg bannoltam már. Kunyizik az adminért, jármûröl bilincsel, stb...nem ez volt az elsõ alkalom.
1830
Segítségkérés / Highlight« Dátum: 2012. január 16. - 16:30:04 »
Szia!Egy elég bonyolult megoldás, de:
Mód elejére: [pawn] new pirosdefine; new feherdefine; forward piros(playerid); forward feher(playerid); [/pawn] Bárhova: [pawn] public piros(playerid) { pirosdefine = SetTimerEx(\"feher\",1000,false,\"i\",playerid); SetPlayerColor(playerid,0xff0000AA); return 1; } public feher(playerid) { feherdefine = SetTimerEx(\"piros\",1000,false,\"i\",playerid); SetPlayerColor(playerid,0xffffffAA); return 1; } [/pawn] public OnPlayerDeath(playerid, killerid, reason) [pawn]public OnPlayerDeath(playerid, killerid, reason) { KillTimer(pirosdefine); KillTimer(feherdefine); return 1; } [/pawn] És 2 parancs(ZCMD): [pawn] CMD:koroz(playerid, params[]) { new giveplayerid; if(sscanf(params, \"u\", giveplayerid)) return SendClientMessage(playerid, 0xFF0000AA, \"Használat: /korozes [playerid]\"); if(giveplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFF0000AA, \"Hiba: Nincs ilyen játékos!\"); if(IsPlayerLadmin(playerid)) { SetTimerEx(\"piros\",1000,false,\"i\",giveplayerid); } else { SendClientMessage(playerid, hiba, \"Nem vagy rendõr!\"); } return 1; } CMD:korozeski(playerid, params[]) { new giveplayerid; if(sscanf(params, \"u\", giveplayerid)) return SendClientMessage(playerid, 0xFF0000AA, \"Használat: /korozeski [playerid]\"); if(giveplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFF0000AA, \"Hiba: Nincs ilyen játékos!\"); if(IsPlayerLadmin(playerid)) { KillTimer(pirosdefine); KillTimer(feherdefine); } else { SendClientMessage(playerid, hiba, \"Nem vagy rendõr!\"); } return 1; } [/pawn] Ha nem jó, szólj, neten írtam! |