Jump to content
  • 0

defectiune comanda /cpos


iSkull

Question

Problema intalnita (descriere): Salut All, am creeat o comanda de editat coordonatele unui job pe SQL, nu imi da erori in joc/sau server_log,

de fiecare data cand vreau sa modific coordonatele unui job tot imi repeta mesajul :"/cjob [job id] [job pos x] [job pos y] [job pos z]" este trecuta pe ZCMD
Ero(area / rile) / warning-(ul / urile): nu da warning/eroare
Liniile de cod / sursa / script-ul(obligatoriu):

CMD:cpos(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
        if(P_DATA[playerid][pAdmin] == 1339)
        {
            new string[256],
                jid,
                cposx,
                cposy,
                cposz;
            if(sscanf(params, "iiii", jid, cposx, cposy, cposz)) return SCM(playerid,COLOR_GREY, SYNTAX_MESSAGE"/cjob [job id] [job pos x] [job pos y] [job pos z]");
            mysql_format(mysql_db, string, sizeof(string), "UPDATE `jobs` SET jobPositionX = '%f', jobPositionY = '%f', jobPositionY = '%f' WHERE `jobID` = '%d' LIMIT 1", cposx, cposy, cposz, jid);
            mysql_tquery(mysql_db, string);
            format(string, sizeof(string),"Job ID: %d | PosX: %f | PosY: %f | PosZ: %f -> a fost UPDATAT cu succes.", jid, cposx, cposy, cposz);
            SCM(playerid, -1, string);
        }
        else
        {
            SCM(playerid,-1,"Nu esti autorizat.");
            return 1;
        }
    }
    return 1;
}


Imagini / Video (optional): -
Ati incercat sa rezolvati singur?:  Da am incercat. M-am uitat si la comanda /gotoxyz sa vad cum este facuta si prin alte gm-uri dar nu am gasit nimik, am incercat sa pun si Float:cposx Float:cposy... etc si degeaba :( am incercat si cu cposx[50] degeaba

Edited by iSkull
Link to comment
Share on other sites

11 answers to this question

Recommended Posts

  • 0

Tu probabil cand scrii comanda scrii asa:

/cpos 3 123.322 -1332.455 13.63

Adica ai si . In numar deci e float modifica asta

 if(sscanf(params, "ifff", jid, cposx, cposy, cposz)) 

 

    __  ____      __           
   /  |/  (_)____/ /____  _____
  / /|_/ / / ___/ __/ _ \/ ___/
 / /  / / (__  ) /_/  __/ /    
/_/  /_/_/____/\__/\___/_/     
SERVICII SCRIPTING DE CALITATE
Pagina     Scripting     pawn
Link to comment
Share on other sites

  • 0

am pus si cum ai zis tu, dar tot nu imi salveaza corect coordonatele in tabel, imi zice ca a fost updatat cu acele coordonate dar in tabel scrie doar la pozitiaX cum trebuie la y doar 2 cifre si la z nimik, am incercart si cu Float:cposx..... si  cu cpos

 

CMD:cpos(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
        if(P_DATA[playerid][pAdmin] == 1339)
        {
            new string[256],
                jid,
                Float:cposx,
                Float:cposy,
                Float:cposz;
            if(sscanf(params, "ifff", jid, cposx, cposy, cposz)) return SCM(playerid,COLOR_GREY, SYNTAX_MESSAGE"/cjob [job id] [job pos x] [job pos y] [job pos z]");
            mysql_format(mysql_db, string, sizeof(string), "UPDATE `jobs` SET jobPositionX = '%f', jobPositionY = '%f', jobPositionY = '%f' WHERE `jobID` = '%d' LIMIT 1", cposx, cposy, cposz, jid);
            mysql_tquery(mysql_db, string);
            format(string, sizeof(string),"Job ID: %d | PosX: %f | PosY: %f | PosZ: %f -> a fost UPDATAT cu succes.", jid, cposx, cposy, cposz);
            SCM(playerid, -1, string);

        }
        else
        {
            SCM(playerid,-1,"Nu esti autorizat.");
            return 1;
        }
    }
    return 1;
}

Link to comment
Share on other sites

  • 0

 nu ar fi    if(sscanf(params, "iddd", jid, cposx, cposy, cposz))   :))   si asta ar insemna sa scrii 

/cpos   12 1020 -1232 12   adica fara .123  

 

    __  ____      __           
   /  |/  (_)____/ /____  _____
  / /|_/ / / ___/ __/ _ \/ ___/
 / /  / / (__  ) /_/  __/ /    
/_/  /_/_/____/\__/\___/_/     
SERVICII SCRIPTING DE CALITATE
Pagina     Scripting     pawn
Link to comment
Share on other sites

  • 0

intra in baza de date pe localhost/phpmyadmin sau unde ai baza de date si intra in tabelul  jobs  dai pe structure si arata o poza la structura

 

    __  ____      __           
   /  |/  (_)____/ /____  _____
  / /|_/ / / ___/ __/ _ \/ ___/
 / /  / / (__  ) /_/  __/ /    
/_/  /_/_/____/\__/\___/_/     
SERVICII SCRIPTING DE CALITATE
Pagina     Scripting     pawn
Link to comment
Share on other sites

  • 0

si zici ca nu se actualizeaza in baza de date? verifica daca faci legatura la baza corecta, si uita-te in mysql log daca iti da eroare

 

    __  ____      __           
   /  |/  (_)____/ /____  _____
  / /|_/ / / ___/ __/ _ \/ ___/
 / /  / / (__  ) /_/  __/ /    
/_/  /_/_/____/\__/\___/_/     
SERVICII SCRIPTING DE CALITATE
Pagina     Scripting     pawn
Link to comment
Share on other sites

  • 0

gata am rezolvat, le-am facut cu varchar, cu float nuh dc nu mergea, + ca am avut o mica problema la linia:

mysql_format(mysql_db, string, sizeof(string), "UPDATE `jobs` SET jobPositionX = '%s', jobPositionY = '%s', jobPositionZ = '%s' WHERE `jobID` = '%d' LIMIT 1", cposx, cposy, cposz, jid); 

era 

mysql_format(mysql_db, string, sizeof(string), "UPDATE `jobs` SET jobPositionX = '%s', jobPositionY = '%s', jobPositionY = '%s' WHERE `jobID` = '%d' LIMIT 1", cposx, cposy, cposz, jid);

puteti da t/c :)

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.