-
Posts
208 -
Joined
-
Last visited
Everything posted by Newbie
-
Fixed that. -- Buy next map function buyMap(player, command, ...) local account = ( ( getPlayerAccount( player ) and not isGuestAccount( getPlayerAccount( player ) ) ) and getPlayerAccount( player ) or false ) if ( account ) then local cashHave = tonumber( getAccountData( account, "cash" ) ) if g_ForcedNextMap then outputChatBox( 'Next map is ' .. getMapName( g_ForcedNextMap ), player ) return end end local query = #{...}>0 and table.concat({...},' ') or nil if not query then if g_ForcedNextMap then outputChatBox( 'Next map is ' .. getMapName( g_ForcedNextMap ), player ) else outputChatBox( 'Next map is not set', player, 255, 0, 0 ) end return end local map = findMap(query) if not map then outputChatBox(errormsg, player) return end if ( cashHave ) and ( cashHave >= 1 ) then if lastmap_B == map then outputChatBox( 'That map has been played too much recently.', player, 255, 0, 0 ) else g_ForcedNextMap = map outputChatBox(getPlayerName(player).. " bought map '" ..getMapName(g_ForcedNextMap).. "' for $1. (/bm)", g_Root, 0, 240, 0) setAccountData( account, "cash", cashHave - 1 ) lastmap_B = g_ForcedNextMap end else outputChatBox("You don't have enough money. ($1)", player, 255, 0, 0) end end addCommandHandler('bm', buyMap) addCommandHandler('buymap', buyMap) I have cash. But the script outputs that i dont. "You don't have enough money. ($1)"
-
Its fine now. When i try tu buy map i get this: [2014-02-12 12:51:18] ERROR: race\racevoting_server.lua:782: attempt to compare number with nil
-
function car( player, cmd ) local account = ( ( getPlayerAccount( player ) and not isGuestAccount( getPlayerAccount( player ) ) ) and getPlayerAccount( player ) or false ) if ( account ) then local cashHave = tonumber( getAccountData( account, "cash" ) ) if ( cashHave ) and ( cashHave >= 1 ) then local vehicle = getPedOccupiedVehicle(player) setTimer(setElementModel,1000,1,vehicle,math.random(399, 609)) outputChatBox( "* " .. getPlayerName( player ) .. " bought a random car.", root, 255, 255, 255, false ) setAccountData( account, "cash", cashHave - 1 ) else outputChatBox( "* You need more cash.", player, 255, 255, 255, false ) end else outputChatBox( "* You're not logged in.", player, 255, 255, 255, false ) end end addCommandHandler( "car", car ) Did it! Thanks for help.
-
function car( player, cmd ) local account = ( ( getPlayerAccount( player ) and not isGuestAccount( getPlayerAccount( player ) ) ) and getPlayerAccount( player ) or false ) if ( account ) then local cashHave = tonumber( getAccountData( account, "cash" ) ) if ( cashHave ) and ( cashHave >= 1 ) then setTimer(setElementModel,1000,1,vehicle,math.random(399, 609)) outputChatBox( "* " .. getPlayerName( player ) .. " bought a random car.", root, 255, 255, 255, false ) setAccountData( account, "cash", cashHave - 1 ) else outputChatBox( "* You need more cash.", player, 255, 255, 255, false ) end else outputChatBox( "* You're not logged in.", player, 255, 255, 255, false ) end end addCommandHandler( "car", car ) I should get a random car, but i dont.
-
Works! can i know what you added ?
-
[2014-02-11 17:56:52] WARNING: buy\buy.lua:2: Bad argument @ 'getPlayerAccount' [Expected element at argument 1, got nil] But i have account system
-
Really strange.. When i type /hay it outputs that i am not logged in. but i am
-
function hay(source, command) local cashHave = getAccountData(account, "cash") if cashHave >= 500 then local x,y,z = getElementPosition( player ) createObject ( 3374 , x , y , z ) setTimer(outputChatBox,50,1,"* "..getPlayerName (source).." bought hay stack",root, 255, 255, 255, true ) setAccountData(account, "cash", -500) else outputChatBox ("* You need more cash",source, 255, 255, 255, true ) cancelEvent() end end addCommandHandler("hay", hay) It should check my money if i have 500 If yes create hay stack But it dont work
-
Totally messed up.. function update() local rankss = getAccountData(account, "Race Loses") end addEventHandler("onPlayerWasted", getRootElement(), update) onPlayerWasted - Same like lose. Because player died. And Race Loses comes +1 What should i add or delete to make it working ?
-
Why not up date the rank at the moment you are losing/winning? Okay! Can you show an example ?
-
I just want to update result when i get when type !rank Lets say i have 1 Lose. And my rank should be R1 I have 6 loses and my rank should be R2. It working, but the rank updating only when player relogins. I need to update because players could see rank everytime it has changed. And dont need to relog
-
function update() local rankss = getAccountData(account, "Race Loses") end addEventHandler("onPlayerWasted", getRootElement(), update) I decided to make it refresh onPlayerWasted but still.. Refresh's only when Login.
-
I will try it It updates only after relogin
-
I have another Q. There's problem. I need to update(refresh) the rank stat every 5 secods. What should i update ? "Race Loses" or "Rank" And what should i use ?
-
Works thanks. addEventHandler ("onPlayerChat",getRootElement(), function(message,type) local nick = getPlayerName(source) local ranks1 = getElementData(player, "Rank") if (string.find(message,"!rank")) and not (string.find(message," !rank")) then outputChatBox("#FFA824*" .. nick .."#FFA824 rank is #FFA824" ..ranks1, getRootElement(), 255, 255, 255, true) end end) When i do in this way. It does not. Where did i failed ?
