Raised This Month: $51 Target: $400
 12% 

Array Problem ?!


  
 
 
Thread Tools Display Modes
Author Message
lgund
Senior Member
Join Date: Jul 2009
Location: Berlin
Old 10-10-2010 , 13:32   Array Problem ?!
#1

Hallo erstmal,
ich habe da ein Problem ^^ ich habe folgendes geshrieben:

Code:
/* Geld entziehen */
cs_take_user_money(id, 1000)

/* MySQL Abfragen */
new Handle:haben_query, haben_Error[128]
haben_query = SQL_PrepareQuery(g_Gamerbanking_Sql_Connect, "SELECT money FROM cz_assasins WHERE steamid='%s'",steamid)

if (!SQL_Execute(haben_query))
{
    SQL_QueryError(haben_query, haben_Error, charsmax(haben_Error))
    server_print("Can't execute MySQL query, error: %s", haben_Error)
    log_amx("Can't execute MySQL query, error: %s", haben_Error)
}else{
    new i_Something, haben_money[32]
    while (SQL_MoreResults(haben_query))
    {
        SQL_ReadResult(haben_query, i_Something, haben_money, 32)
        
        new new_money = haben_money[0] + 1000;
        
        /*if(haben_money[20] >= 100000)
        {
            haben_money[20] = 100000
        }*/
        
        client_print(id, print_chat, "%s", haben_money)
        
        haben_query = SQL_PrepareQuery(g_Gamerbanking_Sql_Connect, "UPDATE cz_assasins SET money = %s WHERE steamid='%s'",haben_money , steamid)
        
        SQL_NextRow(haben_query)
    }
    SQL_FreeHandle(haben_query)
}
und mein Problem liegt darin, das ich das Array "haben_money[32]" nicht mit 1000 addieren kann ^^ ich hoffe mir kann da einer helfen. Ich denke das es nur ein kleiner Fehler ist aber ich verzweifle nun schon seit paar Tagen dran ^^.

Vielen Dank schonmal im vorraus.

Mit freundlichen Gruß
NiTroX
__________________
You need help on Coding ?? Look on my Homepage: http://First-Coder.de/
You want FUN in Counter-Strike ;) ?? Look on my Community:
http://deathmanns.first-coder.de/
lgund is offline
Send a message via MSN to lgund Send a message via Skype™ to lgund
|PJ| Shorty
Veteran Member
Join Date: Aug 2005
Location: Bavaria, Germany
Old 10-11-2010 , 03:54   Re: Array Problem ?!
#2

lade haben_money als int aus der db und nicht als string
andere möglichkeit wäre auch den string nach int umzuwandeln (http://www.amxmodx.org/funcwiki.php?go=func&id=52)
__________________
There are only 10 types of people in the world:
Those who understand binary, and those who don´t.
|PJ| Shorty is offline
Send a message via ICQ to |PJ| Shorty Send a message via AIM to |PJ| Shorty Send a message via MSN to |PJ| Shorty Send a message via Yahoo to |PJ| Shorty Send a message via Skype™ to |PJ| Shorty
lgund
Senior Member
Join Date: Jul 2009
Location: Berlin
Old 10-11-2010 , 04:24   Re: Array Problem ?!
#3

habe es nun so reingeschrieben

Code:
new new_money
new_money = str_to_num(haben_money)
new_money = new_money + 1000
leider geht es immernoch nicht
__________________
You need help on Coding ?? Look on my Homepage: http://First-Coder.de/
You want FUN in Counter-Strike ;) ?? Look on my Community:
http://deathmanns.first-coder.de/
lgund is offline
Send a message via MSN to lgund Send a message via Skype™ to lgund
|PJ| Shorty
Veteran Member
Join Date: Aug 2005
Location: Bavaria, Germany
Old 10-12-2010 , 02:25   Re: Array Problem ?!
#4

warum so umständlich über ein array, lies es als int aus der db
PHP Code:
new_money SQL_ReadResult(haben_query,0)
new_money += 1000
client_print
(idprint_chat"%d"new_money
__________________
There are only 10 types of people in the world:
Those who understand binary, and those who don´t.
|PJ| Shorty is offline
Send a message via ICQ to |PJ| Shorty Send a message via AIM to |PJ| Shorty Send a message via MSN to |PJ| Shorty Send a message via Yahoo to |PJ| Shorty Send a message via Skype™ to |PJ| Shorty
lgund
Senior Member
Join Date: Jul 2009
Location: Berlin
Old 10-12-2010 , 09:54   Re: Array Problem ?!
#5

ok THX geht
__________________
You need help on Coding ?? Look on my Homepage: http://First-Coder.de/
You want FUN in Counter-Strike ;) ?? Look on my Community:
http://deathmanns.first-coder.de/
lgund is offline
Send a message via MSN to lgund Send a message via Skype™ to lgund
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:12.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode