Jump to content

help


golanu21

Recommended Posts

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) 
         

Link to comment
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.

Link to comment
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

Link to comment
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 
) 
    

Link to comment

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 by Guest
Link to comment
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 by Guest
Link to comment
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

Link to comment

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 by Guest
Link to comment
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?

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...