Why you ignoring me guys :S
#1

i opened more than 3 threads in different questions and no one came and helped


and now i am facing an annoying problem when i execute my function which retrieve character data from the database the server crashes

code:
pawn Код:
stock ret_cDATA(playerid)
{
    new
        Query[ 256 ],
        DBResult: Result,
        pName[ MAX_PLAYER_NAME ],
        Field[ 50 ]
    ;
    GetPlayerName(playerid, pName, sizeof(pName));
    format(Query, sizeof(Query), "SELECT * FROM `Accounts` WHERE `NAME` = '%s' COLLATE NOCASE", DB_Escape(pName));
    Result = db_query(DATABASE, Query);
   
    if(db_num_rows(Result))
    {  
        db_get_field_assoc(Result, "rSTEP", Field, 30);
        pInfo[playerid][prSTEP] = strval(Field);
       
        db_get_field_assoc(Result, "SQ", Field, 300);
        pInfo[playerid][pSQ] = strval(Field);
   
        db_get_field_assoc(Result, "SA", Field, 300);
        pInfo[playerid][pSA] = strval(Field);

        db_get_field_assoc(Result, "IP", Field, 30);
        pInfo[playerid][pIP] = strval(Field);
       
        db_get_field_assoc(Result, "REGISTRATIONDATE", Field, 30);
        pInfo[playerid][pRDATE] = strval(Field);
       
        db_get_field_assoc(Result, "VIPLEVEL", Field, 30);
        pInfo[playerid][pVIPLVL] = strval(Field);
       
        db_get_field_assoc(Result, "ADMINLEVEL", Field, 30);
        pInfo[playerid][pADMINLVL] = strval(Field);
       
        db_get_field_assoc(Result, "PLEVEL", Field, 30);
        pInfo[playerid][pPLAYERLVL] = strval(Field);
       
        db_get_field_assoc(Result, "WANTEDLEVEL", Field, 30);
        pInfo[playerid][pWANTEDLVL] = strval(Field);
   
        db_get_field_assoc(Result, "CASH", Field, 30);
        pInfo[playerid][pMONEY] = strval(Field);
   
        db_get_field_assoc(Result, "KILLS", Field, 30);
        pInfo[playerid][pKILLS] = strval(Field);
       
        db_get_field_assoc(Result, "DEATHS", Field, 30);
        pInfo[playerid][pDEATHS] = strval(Field);
       
        db_get_field_assoc(Result, "X", Field, 30);
        pInfo[playerid][pX] = strval(Field);
       
        db_get_field_assoc(Result, "Y", Field, 30);
        pInfo[playerid][pY] = strval(Field);
       
        db_get_field_assoc(Result, "Z", Field, 30);
        pInfo[playerid][pZ] = strval(Field);
       
        db_get_field_assoc(Result, "INTERIOR", Field, 30);
        pInfo[playerid][pINTERIOR] = strval(Field);
       
        db_get_field_assoc(Result, "WORLD", Field, 30);
        pInfo[playerid][pWORLD] = strval(Field);
       
        db_get_field_assoc(Result, "HEALTH", Field, 30);
        pInfo[playerid][pHEALTH] = strval(Field);
       
        db_get_field_assoc(Result, "ARMOR", Field, 30);
        pInfo[playerid][pARMOR] = strval(Field);
       
        db_get_field_assoc(Result, "SKIN", Field, 30);
        pInfo[playerid][pSKIN] = strval(Field);
       
        db_get_field_assoc(Result, "WEAP1", Field, 30);
        pInfo[playerid][pWEAP1] = strval(Field);
       
        db_get_field_assoc(Result, "WEAP1A", Field, 30);
        pInfo[playerid][pWEAP1A] = strval(Field);
       
        db_get_field_assoc(Result, "WEAP2", Field, 30);
        pInfo[playerid][pWEAP2] = strval(Field);
       
        db_get_field_assoc(Result, "WEAP2A", Field, 30);
        pInfo[playerid][pWEAP2A] = strval(Field);
       
        db_get_field_assoc(Result, "WEAP3", Field, 30);
        pInfo[playerid][pWEAP3] = strval(Field);
       
        db_get_field_assoc(Result, "WEAP3A", Field, 30);
        pInfo[playerid][pWEAP3A] = strval(Field);
       
        db_get_field_assoc(Result, "WEAP4", Field, 30);
        pInfo[playerid][pWEAP4] = strval(Field);
       
        db_get_field_assoc(Result, "WEAP4A", Field, 30);
        pInfo[playerid][pWEAP4A] = strval(Field);
       
        db_get_field_assoc(Result, "WEAP5", Field, 30);
        pInfo[playerid][pWEAP5] = strval(Field);
       
        db_get_field_assoc(Result, "WEAP5A", Field, 30);
        pInfo[playerid][pWEAP5A] = strval(Field);
       
        db_get_field_assoc(Result, "WEAP6", Field, 30);
        pInfo[playerid][pWEAP6] = strval(Field);
       
        db_get_field_assoc(Result, "WEAP6A", Field, 30);
        pInfo[playerid][pWEAP6A] = strval(Field);
       
        db_get_field_assoc(Result, "JAILED", Field, 30);
        pInfo[playerid][pJAILED] = strval(Field);
       
        db_get_field_assoc(Result, "JAILEDTIME", Field, 30);
        pInfo[playerid][pJAILTIME] = strval(Field);
       
        db_get_field_assoc(Result, "WARNINGS", Field, 30);
        pInfo[playerid][pWARNINGS] = strval(Field);
       
        db_get_field_assoc(Result, "MUTED", Field, 30);
        pInfo[playerid][pMUTED] = strval(Field);
       
        db_get_field_assoc(Result, "COLOR", Field, 30);
        pInfo[playerid][pCOLOR] = strval(Field);
    }
}
Reply
#2

huh ? not ended ?
return; in the bottom
Reply
#3

Fail.
Reply
#4

Quote:
Originally Posted by Roddan
Посмотреть сообщение
Fail.
You are not welcome here [JUST A NOTICE FOR YOU], Because some THING like you ofc barely know something about programing
Reply
#5

Quote:
Originally Posted by Adam_Hardy
Посмотреть сообщение
huh ? not ended ?
return; in the bottom
no there is a return but just i forgot to paste here
Reply
#6

It's probably an empty result, print out the query numnuts.
Reply
#7

Yea its an empty result that makes it crash you are right i noticed that now but the problem now is that i cant make such long query to fill all the fields in the database when someone registers an account

i am trying this on register but it does not work

pawn Код:
strcat(LQuery,"INSERT INTO `Accounts` (`NAME`, `PASSWORD`, `IP`, `rSTEP`, `REGISTRATIONDATE`, `SQ`, `SA`, `VIPLEVEL`, `ADMINLEVEL`, `PLEVEL`, `WANTEDLEVEL`, `SCORE`, `CASH`, `KILLS`, `DEATHS`, `X`, `Y`, `Z`, `INTERIOR`, `WORLD`, `HEALTH`, `ARMOR`, `SKIN`, `WEAP1`, `WEAP1A`, `WEAP2`, `WEAP2A`, `WEAP3`, `WEAP3A`, `WEAP4`, `WEAP4A`, `WEAP5`, `WEAP5A`, `WEAP6`, `WEAP6A`, `JAILED`, `JAILEDTIME`, `WARNINGS`, `MUTED`, `COLOR`)");
strcat(LQuery," VALUES('%s', '%s', '%s', '%s', '%s', '0', '0', '0', '0', '0', '0', '0', '5000', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0')");

format(Query, sizeof(Query), LQuery, DB_Escape(pName), DB_Escape(inputtext), DB_Escape(IP), DB_Escape("1"), DB_Escape(rDate));
db_query(DATABASE, Query);
When i remove the SQ and SA and VIPLEVEL from the query it fills the databse correctly when adding it it does not work

although the i set the LQuery and the Query to [640]
Reply
#8

Make the query smaller?
Half the query you have and put one half in one query and put the other half in another query?
make another query
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)