Try Posted March 9, 2011 Share Posted March 9, 2011 Hello Again! I need one Help with this code: addEventHandler("onPlayerWasted", getRootElement(), function () local x, y, z = getElementPosition(source) spawnPlayer ( source, x, y, z, 0, math.random(0, 200) ) end ) It is spawming real fast I add one setTimer but don't go Who can help me Link to comment
Chlorek Posted March 9, 2011 Share Posted March 9, 2011 If I right understand you wanna add timer but it doesn't work... Try use addEventHandler("onPlayerWasted", getRootElement(), function () local x, y, z = getElementPosition(source) local skin = math.random(0, 200) setTimer(spawnPlayer, 5000, 1, source, x, y, z, 0, skin) end ) I am not great scripter so if not work set line "setTimer(spawnPlayer, 5000, 1, source, x, y, z, 0, skin)" to setTimer(spawnPlayer, 5000, 1, source, x, y, z, 0, tonumber(skin)) Link to comment
Wojak Posted March 9, 2011 Share Posted March 9, 2011 not all numbers between 0 and 200 are valid skin id's https://wiki.multitheftauto.com/wiki/Character_Skins Link to comment
Chlorek Posted March 9, 2011 Share Posted March 9, 2011 not all numbers between 0 and 200 are valid skin id'shttps://wiki.multitheftauto.com/wiki/Character_Skins Yea, but he can add one thing to block selecting wrong ID. Just if e.g. ID 199 is valid he can set if(tonumber(skin) == 199) then skin = math.random(0,200) end Then if skin ID is 199 it'll be generated again p.s. the code is example and in IDs 0-200 isn't many valid. Link to comment
Castillo Posted March 9, 2011 Share Posted March 9, 2011 I think would be easier to make a table with the valid skin ids and then randomize from there Link to comment
Moderators Citizen Posted March 9, 2011 Moderators Share Posted March 9, 2011 (edited) Yeah I think too and I make for you a script which write me all valid Skin: Code EDITED ! invalidSkin={1,2,3,4,5,6,8,42,65,74,86,119,149,208,239,265,266,267,268,269,270,271,272,273} function isAValidSkin( skinID ) for k, i in ipairs( invalidSkin ) do if ( tonumber( skinID ) == tonumber( i ) ) then return false end end return true end function writeTable( txt ) local savefile = fileOpen( "table.txt" ) if ( savefile ) then fileSetPos( savefile, fileGetSize( savefile ) ) fileWrite( savefile, txt.."," ) end fileClose( savefile ) end function createTable( thePlayer, commandName ) for k=0, 273 do if ( isAValidSkin( k ) )then writeTable( k ) end end end addCommandHandler("skinTable", createTable, false, false )) I copy-paste all the numbers in this table: EDIT: Now it's the real valid skins table ! validSkin={0,7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,66,67,68,69,70,71,72,73,75,76,77,78,79,80,81,82,83,84,85,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264} Enjoy with this big table ! Edited March 10, 2011 by Guest Link to comment
InDev Posted March 10, 2011 Share Posted March 10, 2011 It seems that your code is incorrect you put: invalidSkin = But you put in your check function: if ( tonumber( skinID ) == tonumber( i ) ) then return true end I think you want to put: if ( tonumber( skinID ) == tonumber( i ) ) then return false end Link to comment
Try Posted March 10, 2011 Author Share Posted March 10, 2011 Ok Thanks I go test all u give for me ;D And one think for Solidsnake14: Hello you remeber my ped topic? u said for no one give me the code now i don't asked for code i only need a help with setTimer and look the other topic they come and post and now u cant say i asked for code ;D Cya! ______________ Kisses babys (im a girl) Link to comment
Moderators Citizen Posted March 10, 2011 Moderators Share Posted March 10, 2011 /!\ I edited my post ( the code and the valid skin table ) /!\ Link to comment
Castillo Posted March 10, 2011 Share Posted March 10, 2011 I don't get what do you mean, explain yourself. Link to comment
Moderators Citizen Posted March 10, 2011 Moderators Share Posted March 10, 2011 I said that I edited my first post because I made an error so in the table I get the valid and the invalid skins Link to comment
Castillo Posted March 10, 2011 Share Posted March 10, 2011 Not you, lol. I meant this: "And one thing for Solidsnake14: Hello you remeber my ped topic? u said for no one give me the code now i don't asked for code i only need a help with setTimer and look the other topic they come and post and now u cant say i asked for code ;D Cya!" Link to comment
Moderators Citizen Posted March 10, 2011 Moderators Share Posted March 10, 2011 LOL my bad sorry Link to comment
Try Posted March 11, 2011 Author Share Posted March 11, 2011 Ok its cuz in other topic you said for no one give the code cuz i asked and now i don't asked and the peoples give by theyselves idk if i write correct or no ;D but don't worry about what i said ;D Kisses Link to comment
Castillo Posted March 11, 2011 Share Posted March 11, 2011 I don't get a f*** of that o,O. Link to comment
Wojak Posted March 11, 2011 Share Posted March 11, 2011 i think it goes something like this: i asked in nother topic if you give me a working script and you said no, in this topic i did not asked for nothing, but people gave me a scripti don't care if you dont understand me, and you shuld not care what i said Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now