• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[REQUEST] Create Player talkaction not working.

frann

New Member
Joined
Feb 28, 2009
Messages
7
Reaction score
0
Hi.
Im making world war server so i need to create players in fast way. Thats why im requesting an talkaction. I made a simple code but its not working :blink:

Code:
function onSay(cid, words, param)

local name, acc, level, voc, hp, mp, cap

local x = string.explode(param, ",")
 
 
	name = x[1]
	acc = tonumber(x[2])
	level = tonumber(x[3])
	voc = tonumber(x[4])
	
	if voc == 1 or voc == 2 then
		hp = (level-8)*5+185
		mp = (level-8)*30+35
		cap = (level-8)*10+470
	elseif voc == 3 then
		hp = (level-8)*10+185
		mp = (level-8)*15+35
		cap = (level-8)*20+470
	elseif voc == 4 then
		hp = (level-8)*15+185
		mp = (level-8)*5+35
		cap = (level-8)*25+470
	end
	
	db.executeQuery("INSERT INTO `players` (`name`,`account_id`,`level`,`vocation`,`health`,`healthmax`,`mana`,`manamax`, `town_id`, `cap`) VALUES (".. name ..", ".. acc ..",".. level ..",".. voc ..",".. hp ..",".. hp ..",".. mp ..",".. mp ..",1,".. cap ..")")
return true
end
 
Well you need to do a lot more sanitizing of your input. Also note since your exploding by comma only a simple space after a comma on the wrong parameter will easily bring the function call down in flames
 
Back
Top