golanu21 Posted March 10, 2013 Posted March 10, 2013 function createped (player, modelid, x1, y1, z1) if modelid and x1 and y1 and z1 then ped1 = createPed ( modelid, x1, y1, z1) setPedFrozen ( ped1, true) else outputChatBox("[invalid Syntax]: /createped [modelid] [x] [y] [z]", player, 255, 0, 0 ) end end addCommandHandler("createped", createped)
golanu21 Posted March 10, 2013 Author Posted March 10, 2013 in debugscript errors not exist, and when i try to create nothing
Sasu Posted March 10, 2013 Posted March 10, 2013 function createped (player, cmd, modelid, x1, y1, z1) local modelid = tonumber(modelid) local x1 = tonumber(x1) local y1 = tonumber(y1) local z1 = tonumber(z1) if modelid and x1 and y1 and z1 then ped1 = createPed ( modelid, x1, y1, z1) setPedFrozen ( ped1, true) else outputChatBox("[invalid Syntax]: /createped [modelid] [x] [y] [z]", player, 255, 0, 0 ) end end addCommandHandler("createped", createped) Try this. And dont spam.
golanu21 Posted March 10, 2013 Author Posted March 10, 2013 function createped (player, cmd, modelid, x1, y1, z1) local modelid = tonumber(modelid) local text = {} local say = text local x1 = tonumber(x1) local y1 = tonumber(y1) local z1 = tonumber(z1) if modelid and x1 and y1 and z1 and text then ped1 = createPed ( modelid, x1, y1, z1) setPedFrozen ( ped1, true) cool = createColRectangle ( x1, y1, z1, 5, 5 ) else outputChatBox("[invalid Syntax]: /createped [modelid] [x] [y] [z] [text]", player, 255, 0, 0 ) end end addCommandHandler("createped", createped) addEventHandler ("onColShapeHit", root, function (hitPlayer) if isElement(cool) and (source == cool) then if(getElementType(hitPlayer) == "player") then if isElement(text) then outputChatBox ( "Bot say:"..text, player, 255, 0, 0 ) end end end end ) line 3
golanu21 Posted March 10, 2013 Author Posted March 10, 2013 i want to make this when player or admin create a ped " /createped [modelid] [x] [y] [z] [text]" the text to appear when i hit the colshape
Sasu Posted March 10, 2013 Posted March 10, 2013 function createped (player, cmd, modelid, x1, y1, z1, text) local modelid = tonumber(modelid) local text = {} local say = text local x1 = tonumber(x1) local y1 = tonumber(y1) local z1 = tonumber(z1) if modelid and x1 and y1 and z1 and text then ped1 = createPed ( modelid, x1, y1, z1) setPedFrozen ( ped1, true) cool = createColRectangle ( x1, y1, z1, 5, 5 ) else outputChatBox("[invalid Syntax]: /createped [modelid] [x] [y] [z] [text]", player, 255, 0, 0 ) end end addCommandHandler("createped", createped) addEventHandler ("onColShapeHit", root, function (hitPlayer) if isElement(cool) and (source == cool) then if(getElementType(hitPlayer) == "player") then if isElement(text) then outputChatBox ( "Bot say:"..text, player, 255, 0, 0 ) end end end end )
Jaysds1 Posted March 10, 2013 Posted March 10, 2013 (edited) So, you want a msg for the ped it self right, and the msg doesn't change when ever you want to create another one? try this: addCommandHandler("createped",function(player, cmd, modelid, x1, y1, z1,msg) if not(modelid or x1 or y1 or z1 or msg) then outputChatBox("[invalid Syntax]: /createped [modelid] [x] [y] [z] [text]", player, 255, 0, 0 ) return end local modelid = tonumber(modelid) local x1 = tonumber(x1) local y1 = tonumber(y1) local z1 = tonumber(z1) ped1 = createPed ( modelid, x1, y1, z1) setPedFrozen ( ped1, true) setElementData(ped1,"msg",table.concat(text,"")) --this stores the msg with the ped cool = createColRectangle ( x1, y1, 5, 5 ) setElementData(cool,"pedcol",true) setElementData(cool,"sourceped",ped1) end) addEventHandler ("onColShapeHit", root,function(hitPlayer) if getElementType(hitPlayer)~="player" or not getElementData(source,"pedcol") then return end local ped = getElementData(source,"sourceped") local text = getElementData(ped,"msg") outputChatBox ( "Bot say:"..text, hitPlayer, 255, 0, 0 ) end) Edited March 10, 2013 by Guest
golanu21 Posted March 10, 2013 Author Posted March 10, 2013 So, you want a msg for the ped it self right--yes and the msg doesn't change when ever you want to create another one?--when you create another one, you can put same text or another
TAPL Posted March 10, 2013 Posted March 10, 2013 (edited) Syntax colshape createColRectangle ( float fX, float fY, float fWidth, float fHeight) Required Arguments fX: The X position of the collision rectangle's west side fY: The Y position of the collision rectangle's south side fWidth: The collision rectangle's width fHeight: The collision rectangle's height Also you need this for the text: table.concat Edited March 10, 2013 by Guest
golanu21 Posted March 10, 2013 Author Posted March 10, 2013 Syntax colshape createColRectangle ( float fX, float fY, float fWidth, float fHeight) Required Arguments fX: The X position of the collision rectangle's west side fY: The Y position of the collision rectangle's south side fWidth: The collision rectangle's width fHeight: The collision rectangle's height i tired with createMarker .. and nothing
Jaysds1 Posted March 10, 2013 Posted March 10, 2013 try my code on my last post: viewtopic.php?f=91&t=55535#p536455
TAPL Posted March 10, 2013 Posted March 10, 2013 try my code on my last post: viewtopic.php?f=91&t=55535#p536455 Read my previous post. viewtopic.php?f=91&t=55535#p536457
Jaysds1 Posted March 10, 2013 Posted March 10, 2013 Thanks TAPL, I knew I was missing something from the code...
golanu21 Posted March 10, 2013 Author Posted March 10, 2013 how i make with table.concat?, i don't know with part of scripting
Jaysds1 Posted March 10, 2013 Posted March 10, 2013 (edited) I've added it in the script.. here: addCommandHandler("createped",function(player, cmd, modelid, x1, y1, z1,...) if not(modelid or x1 or y1 or z1 or msg) then outputChatBox("[invalid Syntax]: /createped [modelid] [x] [y] [z] [text]", player, 255, 0, 0 ) return end local modelid = tonumber(modelid) local x1 = tonumber(x1) local y1 = tonumber(y1) local z1 = tonumber(z1) ped1 = createPed ( modelid, x1, y1, z1) setPedFrozen ( ped1, true) setElementData(ped1,"msg",table.concat(...,"")) --this stores the msg with the ped cool = createColRectangle ( x1, y1, 5, 5 ) setElementData(cool,"pedcol",true) setElementData(cool,"sourceped",ped1) end) addEventHandler ("onColShapeHit", root,function(hitPlayer) if getElementType(hitPlayer)~="player" or not getElementData(source,"pedcol") then return end local ped = getElementData(source,"sourceped") local text = getElementData(ped,"msg") outputChatBox ( "Bot say:"..text, hitPlayer, 255, 0, 0 ) end) EDITED! Edited March 10, 2013 by Guest
golanu21 Posted March 10, 2013 Author Posted March 10, 2013 47: bad argument #1 to 'concat' (table expected, got nil)
Sasu Posted March 10, 2013 Posted March 10, 2013 Syntax colshape createColRectangle ( float fX, float fY, float fWidth, float fHeight) Required Arguments fX: The X position of the collision rectangle's west side fY: The Y position of the collision rectangle's south side fWidth: The collision rectangle's width fHeight: The collision rectangle's height Also you need this for the text: table.concat local message = table.concat ( { msg } ) Is it correctly?
golanu21 Posted March 10, 2013 Author Posted March 10, 2013 how i make this, please give me full script
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