Jump to content

Some Stupid questions :D


Blaawee

Recommended Posts

hi all i have this code , all i want to do get the player name who typed that command

function cc(thePlayer) 
    if hasObjectPermissionTo ( "user."..getAccountName(getPlayerAccount(player)), "function.setPlayerMuted" ) then 
        outputChatBox(" ") 
        outputChatBox(" ") 
        outputChatBox(" ") 
        outputChatBox(" ") 
        outputChatBox(" ") 
        outputChatBox(" ") 
        outputChatBox(" ") 
        outputChatBox(" ") 
        outputChatBox(" ") 
        outputChatBox(" ") 
        outputChatBox(" ") 
        outputChatBox(" ") 
        outputChatBox(" ") 
        outputChatBox(" ") 
        outputChatBox(" ") 
        outputChatBox(" ") 
        outputChatBox(" ") 
        outputChatBox(" ") 
        outputChatBox(" ") 
        outputChatBox(" ") 
        outputChatBox(" ")       
        outputChatBox("* #ff0000INFO:#ffff00ADMIN #00ff00".. thePlayer .." #ffff00CLEARED THE CHAT",255,12,15, true)         
       else 
       outputChatBox ("You are Not Admin", thePlayer, 193, 13, 13) 
     end 
end 
addCommandHandler("cc", cc) 

Edited by Guest
Link to comment
  • Replies 64
  • Created
  • Last Reply

Top Posters In This Topic

function clear(player) 
    if hasObjectPermissionTo(player, "function.setPlayerMuted", false) then 
    for i=1,30 do 
        outputChatBox(" ") 
    end  
          outputChatBox("* #ff0000INFO:#ffff00ADMIN #00ff00"..getPlayerName(player).." #ffff00CLEARED THE CHAT",root,255,12,15, true) 
     else 
          outputChatBox ("You are Not Admin", player, 193, 13, 13) 
     end 
end 
addCommandHandler("cc", clear) 

Link to comment
function clear(player) 
    if hasObjectPermissionTo(player, "function.setPlayerMuted", false) then 
    for i=1,30 do 
        outputChatBox(" ") 
    end  
          outputChatBox("* #ff0000INFO:#ffff00ADMIN #00ff00"..getPlayerName(player).." #ffff00CLEARED THE CHAT",root,255,12,15, true) 
     else 
          outputChatBox ("You are Not Admin", player, 193, 13, 13) 
     end 
end 
addCommandHandler("cc", clear) 

I wish you would tell him what you did.

He can't learn from your fix if you just post a working script.

No offence..

Link to comment
function clear(player) 
    if hasObjectPermissionTo(player, "function.setPlayerMuted", false) then -- We check if the player has permission to use the function "setPlayerMuted". 
    for i=1,30 do -- We make a for-loop from 1 to 30, this will output repeat the same thing 30 times. 
        outputChatBox(" ") -- We output a empty chatbox message (the loop will make this output 30 times). 
    end -- We end the for-loop. 
          outputChatBox("* #ff0000INFO:#ffff00ADMIN #00ff00"..getPlayerName(player).." #ffff00CLEARED THE CHAT",root,255,12,15, true) -- We output to chatbox the name of the player who executed the command. 
     else -- If he player doesn't has permission to use the function "setPlayerMuted". 
          outputChatBox ("You are Not Admin", player, 193, 13, 13) -- We output to the player who executed the command that he/she is not an admin. 
     end 
end 
addCommandHandler("cc", clear) 

Link to comment

actully Capy Did it , thx capy

i think with the images is easy

EDIT

i got this login panel :

client :

-- Setting 
blackLoginScreen = true 
enableKickPlayer = true 
disallowLogout = false 
removeBlackScreenTime = 4 
maxLoginAttempts = 5  
------------ 
  
local localPlayer = getLocalPlayer() 
local playerName = getPlayerName(localPlayer) 
local x,y = guiGetScreenSize() 
  
------------ 
  
--main window 
  
function createLoginWindow() 
    GUIEditor_Button = {} 
    GUIEditor_Image = {} 
     
    window = guiCreateWindow(254,200,303,307,"Login Panel",false) 
    guiSetAlpha(window,0.60000002384186) 
    guiWindowSetMovable(window,false) 
    guiWindowSetSizable(window,false) 
    logo = guiCreateStaticImage(62,23,187,38,"images/logo.png",false,window) 
    guiSetAlpha( logo, 0.70) 
    username_l = guiCreateLabel(7,75,289,24,"User Name",false,window) 
    guiLabelSetColor(username_l, 255, 0, 0) 
    guiLabelSetVerticalAlign(username_l,"top") 
    guiLabelSetHorizontalAlign(username_l,"left",false) 
    guiSetFont(username_l,"default-bold") 
    username = guiCreateEdit(9,100,285,25,"",false,window) 
    password_l = guiCreateLabel(7,140,289,24,"Password",false,window) 
    guiLabelSetColor(password_l, 255, 0, 0) 
    guiLabelSetVerticalAlign(password_l,"top") 
    guiLabelSetHorizontalAlign(password_l,"left",false) 
    guiSetFont(password_l,"default-bold") 
    password = guiCreateEdit(9,168,285,25,"",false,window) 
    login = guiCreateButton(9,245,143,53,"Login",false,window) 
    register = guiCreateButton(153,245,135,53,"Register",false,window) 
    labelInfo = guiCreateLabel(7,212,288,24,"   Please Register Or Login",false,window) 
    guiLabelSetColor(labelInfo,255, 255, 0) 
    guiLabelSetVerticalAlign(labelInfo,"top") 
    guiLabelSetHorizontalAlign(labelInfo,"left",false) 
    Guest = guiCreateButton(9,142,240,25,"Login As Guest",true,window) 
end 
  
-- change password window 
  
function PasswordWindow() 
    GUIEditor_Button = {} 
    GUIEditor_Image = {} 
  
    windowpw = guiCreateWindow(254,137,303,307,"Change Your Password",false) 
    guiWindowSetMovable(windowpw,false) 
    guiWindowSetSizable(windowpw,false) 
    username_lpw = guiCreateLabel(7,75,289,24,"             Old Password :",false,windowpw) 
    guiLabelSetColor(username_lpw,255, 0, 0) 
    guiLabelSetVerticalAlign(username_lpw,"top") 
    guiLabelSetHorizontalAlign(username_lpw,"left",false) 
    guiSetFont(username_lpw,"default-bold") 
    usernamepw = guiCreateEdit(9,100,285,25,"",false,windowpw) 
    password_lpw = guiCreateLabel(7,140,289,24,"             New Password :",false,windowpw) 
    guiLabelSetColor(password_lpw, 255, 0, 0) 
    guiLabelSetVerticalAlign(password_lpw,"top") 
    guiLabelSetHorizontalAlign(password_lpw,"left",false) 
    guiSetFont(password_lpw,"default-bold") 
    passwordpw = guiCreateEdit(9,168,285,25,"",false,windowpw) 
    chgpass = guiCreateButton(153,245,135,53,"Done",false,windowpw) 
    errorl = guiCreateLabel(7,212,288,24,"",false,windowpw) 
    guiLabelSetColor(errorl,255, 255, 0) 
    guiLabelSetVerticalAlign(errorl,"top") 
    guiLabelSetHorizontalAlign(errorl,"left",false) 
    guiSetVisible(windowpw, false) 
end 
  
-- Guest mode 
  
function onClickGuest(button,state) 
    if(button == "left" and state == "up") then 
        if (source == Guest) then 
            guiSetVisible(window, false) 
            guiSetInputEnabled(false) 
            showCursor(false) 
            if blackLoginScreen == true then 
                fadeCamera(true,removeBlackScreenTime) 
            end 
        end 
    end 
end 
addEventHandler("onClientGUIClick", Guest, onClickGuest) 
  
function resourceStart() 
    createLoginWindow() 
    if (window ~= nil) then 
        guiSetVisible(window, true) 
    else 
        outputChatBox("An error has occurred.", 255, 0, 0, true) 
    end 
    showCursor(true) 
    guiSetInputEnabled(true) 
end 
addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), resourceStart) 
  
-- image 
  
function image() 
    if ( x == 800 ) and ( y == 600 ) then 
     img = guiCreateStaticImage(0,0,800,600,"images/backgroundlogin.png",false) 
        elseif ( x == 1280 ) and ( y == 720 ) then 
        img = guiCreateStaticImage(0,0,1280,720,"images/backgroundlogin.png",false) 
        guiMoveToBack( img ) 
    end 
end 
addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), image) 
  
function changePw() 
    PasswordWindow() 
    guiSetVisible(windowpw, true) 
    showCursor(true) 
    guiSetInputEnabled(true) 
end 
bindKey ( "F7", "down", changePw ) 
addCommandHandler("pass", changePw) 
  
function clientSubmitLogin(button, state) 
    if button == "left" and state == "up" then 
        local username = guiGetText(username) 
        local password = guiGetText(password) 
        if username and password then 
            triggerServerEvent("submitLogin", getRootElement(), localPlayer, username, password) 
        else 
            guiSetText(labelInfo, "Enter username and password.") 
        end 
    end 
end 
addEventHandler("onClientGUIClick", login, clientSubmitLogin, false) 
  
function clientSubmitRegister(button, state) 
    if button == "left" and state == "up" then 
        local username = guiGetText(username) 
        local password = guiGetText(password) 
        if username and password then 
            triggerServerEvent("submitRegister", getRootElement(), localPlayer, username, password) 
        else 
            guiSetText(labelInfo, "Enter Your Username And Password", 255, 0, 0, true) 
        end 
    end 
end 
addEventHandler("onClientGUIClick", register, clientSubmitRegister, false) 
  
function clientSubmitChangepw(button, state) 
    if button == "left" and state == "up" then 
        local oldpassword = guiGetText(usernamepw) 
        local newpassword = guiGetText(passwordpw) 
        if oldpassword and newpassword then 
            triggerServerEvent("submitChangepw", getRootElement(), localPlayer, oldpassword, newpassword) 
        else 
            outputChatBox("Enter Old And New Password", 255, 0, 0, true) 
        end 
    end 
end 
addEventHandler("onClientGUIClick", chgpass, clientSubmitChangepw, false) 
  
function hideLoginWindow() 
    guiSetInputEnabled(false) 
    guiSetVisible(window, false) 
    showCursor(false) 
    guiSetVisible ( img, false ) 
end 
addEvent("hideLoginWindow", true) 
addEventHandler("hideLoginWindow", getRootElement(), hideLoginWindow) 
  
function hidePasswordWindow() 
    guiSetInputEnabled(false) 
    guiSetVisible(windowpw, false) 
    showCursor(false) 
end 
addEvent("hidePasswordWindow", true) 
addEventHandler("hidePasswordWindow", getRootElement(), hidePasswordWindow) 
  
function unknownError() 
    guiSetText(labelInfo, "    Please Try To Remember Your Old Password") 
end 
addEvent("unknownError", true) 
addEventHandler("unknownError", getRootElement(), unknownError) 
  
function loginWrong() 
    guiSetText(labelInfo, "    Bad password") 
end 
addEvent("loginWrong", true) 
addEventHandler("loginWrong", getRootElement(), loginWrong) 
  
function registerTaken() 
    guiSetText(labelInfo, "    This username already exist") 
end 
addEvent("registerTaken", true) 
addEventHandler("registerTaken", getRootElement(), registerTaken) 

server :

function passwordHandler(player, oldpassword, newpassword) 
    local account = getPlayerAccount(player) 
    if (account) then 
        if (isGuestAccount(account)) then 
            outputChatBox("You Have To Login To Change You Password", player, 255, 0, 0, true) 
            return 
        end 
        local playerName = getPlayerName(player) 
        local password_check = getAccount(playerName, oldpassword) 
        if (password_check ~= false) then 
            if (string.len(newpassword) >= 5) then 
                setAccountPassword(account, newpassword) 
                triggerClientEvent(player, "hidePasswordWindow", getRootElement()) 
            else 
                outputChatBox("The Password Should Be More Than 5 Numbers Or Leter", player, 255, 0, 0, true) 
            end 
        else 
            outputChatBox("Your Old Password Is Wrong", player, 255, 0, 0, true) 
        end 
    end 
end 
addEvent("submitChangepw", true) 
addEventHandler("submitChangepw", root, passwordHandler) 
  
function loginHandler(player, username, password) 
    local account = getAccount(username, password) 
    if (account ~= false) then 
        if (logIn(player, account, password) == true) then 
            outputChatBox("To Change Your Password Press F7", player, 255, 0, 0, true) 
            triggerClientEvent (player, "hideLoginWindow", getRootElement()) 
        else 
            triggerClientEvent (player, "unknownError", getRootElement()) 
        end 
    else 
        triggerClientEvent (player, "loginWrong", getRootElement()) 
    end 
end 
addEvent("submitLogin", true) 
addEventHandler("submitLogin", root, loginHandler) 
  
function registerHandler(player, username, password) 
    local account = getAccount(username, password) 
    if (account ~= false) then 
        triggerClientEvent(player, "registerTaken", getRootElement()) 
    else 
        account = addAccount(username, password) 
        if (logIn(player, account, password) == true) then 
            outputChatBox("To Change Your Password Press F7", player, 255, 0, 0, true) 
            triggerClientEvent(player, "hideLoginWindow", getRootElement()) 
        else 
            triggerClientEvent(player, "unknownError", getRootElement()) 
        end 
    end 
end 
addEvent("submitRegister", true) 
addEventHandler("submitRegister", root, registerHandler) 

no error but, when i try to login or register the background dosn't despear and i cant login or register

Link to comment

o.k guys this what i did about the windows , i don't know if this right or not :

GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Checkbox = {} 
GUIEditor_Label = {} 
GUIEditor_Grid = {} 
  
Main = guiCreateStaticImage( 228,648,900,72,"Wnds.png",false ) 
guiSetAlpha( Main,255 ) 
guiSetVisible( Main, false ) 
car_b = guiCreateStaticImage( 34, 26, 133, 37, "butt.png", false, Main ) 
guiSetAlpha( car_b, 255 ) 
weather_b = guiCreateStaticImage( 173, 27, 133, 36, "butt.png", false, Main ) 
guiSetAlpha( weather_b, 255 ) 
Map_b = guiCreateStaticImage( 312, 27, 133, 35, "butt.png", false, Main ) 
guiSetAlpha( Map_b, 255 ) 
Weapon_b = guiCreateStaticImage( 450, 26, 133, 36, "butt.png", false, Main ) 
guiSetAlpha( Weapon_b, 255 ) 
Stats_b = guiCreateStaticImage( 590, 25, 133, 38, "butt.png", false, Main ) 
guiSetAlpha( Stats_b, 255 ) 
Skins_b = guiCreateStaticImage( 729, 25, 133, 37, "butt.png", false, Main ) 
guiSetAlpha( Skins_b, 255 ) 
  
car = guiCreateWindow( 267, 648, 123, 240, "Car", false ) 
guiWindowSetSizable( car,false ) 
guiSetVisible( car, false ) 
create = guiCreateButton( 14, 26, 92, 32, "create", false, car) 
repaiir = guiCreateButton( 14, 64, 92, 32, "repaiir", false, car) 
flip = guiCreateButton( 13, 103, 92, 32, "flip", false, car ) 
color = guiCreateButton( 13, 144, 92, 32, "color", false, car) 
upgrades = guiCreateButton( 14, 187, 90, 32, "upgrades", false,car ) 
  
Weather = guiCreateWindow(406,649,123,240,"Weather", false) 
guiWindowSetSizable( Weather,false ) 
guiSetVisible( Weather, false ) 
Weather_grid = guiCreateGridList(9,20,105,211,false, Weather) 
guiGridListSetSelectionMode( Weather_grid, 2 ) 
guiGridListAddColumn( Weather_grid, "Weather Type", 0.2 ) 
  
Map = guiCreateWindow(683,649,123,240,"Map",false) 
guiWindowSetSizable( Map, false ) 
guiSetVisible( Map, false ) 
Map = guiCreateButton(10,36,104,67,"Map",false,Map) 
Int = guiCreateButton(12,135,101,67,"Int",false,Map) 
  
Weapon = guiCreateWindow(823,650,123,240,"Weapon",false) 
guiWindowSetSizable(Weapon,false) 
guiSetVisible( Weapon, false ) 
weapon_grid = guiCreateGridList(9,20,105,211,false,Weapon) 
guiGridListSetSelectionMode( weapon_grid, 2 ) 
guiGridListAddColumn( weapon_grid, "WeaponS", 0.2 ) 
  
Stats = guiCreateWindow(963,650,123,240,"Stats",false) 
guiWindowSetSizable( Stats, false ) 
guiSetVisible( Stats, false ) 
Vehicles = guiCreateLabel(9,35,73,28,"Vehicles",false,Stats) 
Current = guiCreateLabel(9,59,93,25,"Current: on foot",false,Stats) 
Lightson = guiCreateCheckBox(14,102,77,25,"Lights on",false,false,Stats) 
Lightsoff = guiCreateCheckBox(14,133,77,25,"Lights off",false,false,Stats) 
  
Skins = guiCreateWindow(544,650,123,240,"Skins",false) 
guiWindowSetSizable( Skins, false ) 
guiSetVisible( Skins, false ) 
skin_grid = guiCreateGridList(10,21,104,210,false, Skins) 
guiGridListSetSelectionMode( skin_grid, 2 ) 
guiGridListAddColumn( skin_grid, "SkinS", 0.2 ) 
  
--[[ 
---------------------- 
car = guiCreateWindow(269,425,123,240,"Car",false) 
Weather = guiCreateWindow(407,425,123,240,"Weather",false) 
Map = guiCreateWindow(682,425,123,240,"Map",false) 
Weapon = guiCreateWindow(822,425,123,240,"Weapon",false) 
Stats = guiCreateWindow(961,424,123,240,"Stats",false) 
Skins = guiCreateWindow(544,426,123,240,"Skins",false) 
---------------------- 
]]-- 
  
  
function slide_Caron() 
    if ( source == car_b ) then 
    Animation.createAndPlay(car, Animation.presets.guiMove(269, 425, 2000)) 
    guiBringToFront ( car ) 
    end 
end 
addEventHandler( "onClientMouseEnter", car_b, slide_Caron ) 
  
function slide_Caroff() 
    if ( source == car_b ) then 
    Animation.createAndPlay(car, Animation.presets.guiMove(267,648, 2000)) 
    guiMoveToBack( car ) 
    end 
end 
addEventHandler( "onClientMouseLeave", car_b, slide_Caroff ) 
  
function ToggleMenu () 
  if guiGetVisible(Main) == true then 
    guiSetVisible(Main, false) 
    guiSetVisible(car, false) 
    guiSetVisible(Weather, false) 
    guiSetVisible(Map, false) 
    guiSetVisible(Weapon, false) 
    guiSetVisible(Stats, false) 
    guiSetVisible(Skins, false) 
    showCursor(false) 
  else 
    guiSetVisible(Main, true) 
    showCursor(true) 
  end 
end 
bindKey("F2", "down", ToggleMenu) 
  

i tried it and it's keep saying

@ line 81 and 89 i don't know why ?

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...