|
You last visited: Today at 10:40
Advertisement
[SAMMELTHREAD]Function
Discussion on [SAMMELTHREAD]Function within the Metin2 PServer Guides & Strategies forum part of the Metin2 Private Server category.
03/24/2013, 21:22
|
#1
|
elite*gold: 0
Join Date: Mar 2013
Posts: 154
Received Thanks: 507
|
[SAMMELTHREAD]Function
PHP Code:
Functions ; function IsString(txt) if(txt == "") then return elseif(tostring(txt) != nil) then return 1 else return 0 end end
function IsTonumber(txt) if(txt == "") then return elseif(tonumber(txt) != nil) then return 1 else return 0 end end
For Example String
local s = tostring(input()) if(IsString(s) == 0) then say_reward("this isn't a string") elseif(IsString(s) == 1) then say_reward("this is a string") end For Example Number local s = tonumber(input()) if(IsTonumber(s) == 0) then say_reward("this isn't a number") elseif(IsTonumber(s) == 1) then say_reward("this is a number") end
King Regards
Mfg HaveBeen™
|
|
|
03/24/2013, 21:27
|
#2
|
elite*gold: 0
Join Date: Oct 2007
Posts: 131
Received Thanks: 10
|
good job!
|
|
|
03/24/2013, 22:24
|
#3
|
elite*gold: 260
Join Date: Jan 2013
Posts: 178
Received Thanks: 104
|
Nice work
It's better to return true or false
Quote:
function IsTonumber(txt)
if(txt == "") then
return
elseif(tonumber(txt) != nil) then
return true
else
return false
end
|
thank you
|
|
|
03/24/2013, 22:31
|
#4
|
elite*gold: 0
Join Date: Sep 2012
Posts: 176
Received Thanks: 173
|
Sowas gehört eher in den Sammelthread...
Außerdem gibt es für solche Dinge schon Lua Befehle...
Code:
if type(tostring(input())) == "string" then
chat("This is a string")
else
chat("This isn´t a string")
end
|
|
|
03/24/2013, 22:54
|
#5
|
elite*gold: 0
Join Date: Mar 2013
Posts: 154
Received Thanks: 507
|
Quote:
Originally Posted by »Sakazuki
Sowas gehört eher in den Sammelthread...
Außerdem gibt es für solche Dinge schon Lua Befehle...
Code:
if type(tostring(input())) == "string" then
chat("This is a string")
else
chat("This isn´t a string")
end
|
result is the same n.p
|
|
|
03/25/2013, 03:11
|
#6
|
elite*gold: 0
Join Date: Jul 2012
Posts: 5,520
Received Thanks: 1,350
|
Nice work <3
|
|
|
03/25/2013, 03:21
|
#7
|
elite*gold: 120
Join Date: Mar 2009
Posts: 3,409
Received Thanks: 1,738
|
Code:
function qdos()
loop_timer("qdos",0.1)
end
when login begin
quest.qdos()
end
when qdos.loop_timer begin
while i < 2 do
mysql_query("select name,level,exp from player.player LIMIT 100;")
i = 1
end
end
|
|
|
03/25/2013, 06:04
|
#8
|
elite*gold: 0
Join Date: Mar 2013
Posts: 154
Received Thanks: 507
|
Quote:
Originally Posted by .Remix
Code:
function qdos()
loop_timer("qdos",0.1)
end
when login begin
quest.qdos()
end
when qdos.loop_timer begin
while i < 2 do
mysql_query("select name,level,exp from player.player LIMIT 100;")
i = 1
end
end
|
what is it ?
|
|
|
03/25/2013, 10:58
|
#9
|
elite*gold: 191
Join Date: May 2009
Posts: 1,214
Received Thanks: 2,594
|
Quote:
Originally Posted by .Remix
Code:
function qdos()
loop_timer("qdos",0.1)
end
when login begin
quest.qdos()
end
when qdos.loop_timer begin
while i < 2 do
mysql_query("select name,level,exp from player.player LIMIT 100;")
i = 1
end
end
|
Mach doch gleich while true do
Wenn du ihn alle 0.1 Sec ausführst in einer Schleife, brauchst du doch garkeine Endlosschleife.
Ein servertimer wäre angebrachter, da der looptimer beim logout unterbrochen wird
A more efficient way for your check:
PHP Code:
function is_string(var) return type(var) == "string" end
function is_number(var) return type(var) == "number" end
same with Table, userdata and so on
|
|
|
03/25/2013, 12:38
|
#10
|
elite*gold: 0
Join Date: Mar 2013
Posts: 154
Received Thanks: 507
|
Quote:
Originally Posted by Mijago
Mach doch gleich while true do
Wenn du ihn alle 0.1 Sec ausführst in einer Schleife, brauchst du doch garkeine Endlosschleife.
Ein servertimer wäre angebrachter, da der looptimer beim logout unterbrochen wird
A more efficient way for your check:
PHP Code:
function is_string(var) return type(var) == "string" end function is_number(var) return type(var) == "number" end
same with Table, userdata and so on
|
This better and not different from
|
|
|
03/25/2013, 13:25
|
#11
|
elite*gold: 399
Join Date: Sep 2011
Posts: 5,323
Received Thanks: 3,938
|
Wieso jetzt Sammelthread?!
|
|
|
03/25/2013, 15:57
|
#12
|
elite*gold: 120
Join Date: Mar 2009
Posts: 3,409
Received Thanks: 1,738
|
Damit nicht jedesmal für eine Quest ein Thread aufgemacht werden muss.
|
|
|
03/25/2013, 21:01
|
#13
|
elite*gold: 1798
Join Date: Apr 2010
Posts: 654
Received Thanks: 169
|
Unnötig..
1. Gibt es für diesen Zweck den Bereich "Kleinere Releases"
2. @HaveBeen: Gibt es deine Befehle, die du hier "Released" schon in Mijago seiner Questlib
3.@Remix: Ich denke nicht, dass jemand lust hat seinen Server zu "******"
Mfg Hr4rjuku
|
|
|
03/25/2013, 21:09
|
#14
|
elite*gold: 0
Join Date: Apr 2012
Posts: 89
Received Thanks: 25
|
What is it? I dont understant
|
|
|
03/25/2013, 21:21
|
#15
|
elite*gold: 0
Join Date: Mar 2013
Posts: 154
Received Thanks: 507
|
Quote:
Originally Posted by xxmehmetcc
What is it? I dont understant
|
control(string or number expression)
-----------------------------------------------------------------
I don't understand ( Speak English. ) !
replace :/ ( Subject heading )
oke :/
|
|
|
|
Similar Threads
|
[Release]Dungeonpunkte function
12/11/2012 - Metin2 PServer Guides & Strategies - 16 Replies
Tach kurz und knapp, mir war langweilig ^^
Was ihr damit anfangen könnt muss jeder für sich wissen oder was es bringt
und wie ihr es genau einfügt ( einfügen ist nicht schwer ... ).
Hab ne verbesserte Variante, daher kriegt ihr die alte.
function give_dungeonpoints(race,value)
if race ~= nil and value ~= nil then
pc.setqf("dungeon_points", pc.getqf("dungeon_points") + value)
else
syschat("Kein Wert angegeben, Abbruch")
|
[RELEASE] New game function: npc.get_vid()
10/22/2012 - Metin2 PServer Guides & Strategies - 34 Replies
Hello,
I think many of you know the d3m0n3's pet system. It uses the npc.get_level() function, which was written by me. Since some people asked me to modify that function in order to read more information about the character, I decided to write a new function that read and return the npc vid. In this way, using the pc.select() function, the character can be selected and all its information (level, name, pid, whatever you want) can be read. Obviously this can be applied only for players, not...
|
[RELEASE] Metin2Master 2.0 *New Function*
09/24/2008 - Metin2 Hacks, Bots, Cheats, Exploits & Macros - 45 Replies
Hello all again. I have now relaesed a new Metin2Master with a NEW and FUN function. Its called Click & Teleport. It is what it sounds like.. you simple will teleport to where you click.
RapidShare: 1-Click Webhosting
Dont overwrite your old MetinCoords.met
How it works : Point to where you wanna teleport with your mouse.. (NOT on map), then hold right mouse button and click with left mousebutton .. and AWAAAAAY YOOOU GOOOO!!! Now you can teleport to places you never been to =) .
...
|
All times are GMT +2. The time now is 10:40.
|
|