BriGhtx3 Posted May 24, 2011 Share Posted May 24, 2011 Here is the crap : function anrufen (thePlayer,commandName,Nummer,...) if Nummer then local result = mysql_query(sqlcon,"SELECT Username FROM user_data WHERE Nummer='"..Nummer.."';") if mysql_num_rows( result ) == 1 then row = mysql_fetch_row(result) else outputChatBox( "Fehler!", source ) end mysql_free_result(result) local anrufer = tonumber(row[1]) outputChatBox("Erfolgreich angerufen!", thePlayer, 255, 255, 0, true) outputChatBox("#00688B[Anruf] Du wurdest von " .. getPlayerName(thePlayer) .. "#00688B angerufen " , anrufer, 255, 255, 0, true) else outputChatBox("Benutzung: /anrufen [NUMMER]", thePlayer, 255, 0, 0, true) return false end end addCommandHandler("anrufen", anrufen) What this crap shall do : if you type /anrufen [number] this script should get out of the database the name of the player with this number. Then I should can chat with him. (is not done yet) Link to comment
BriGhtx3 Posted May 24, 2011 Author Share Posted May 24, 2011 There is not really an error, just it puts out : "Fehler!", "Erfolgreich angerufen!" AND "[Anruf] Du wurdest von " .. getPlayerName(thePlayer) .. " angerufen" Link to comment
NeXTreme Posted May 25, 2011 Share Posted May 25, 2011 If you would like the function to stop executing when the "Fehler!" is outputted, add a return before the end else outputChatBox( "Fehler!", source ) return end Link to comment
BriGhtx3 Posted May 25, 2011 Author Share Posted May 25, 2011 The error is, the message is shown to every player, and not the one with this nmber Link to comment
karlis Posted May 25, 2011 Share Posted May 25, 2011 use thePlayer, not source. also anrufer var is not permited in outputChatBox Link to comment
BriGhtx3 Posted May 25, 2011 Author Share Posted May 25, 2011 Yes this is one error. But not the one i am searching for. You see that it puts out Fehler, that means something with the mysql_num_rows is the error. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now