Jump to content
  • 0

defectiune comanda /cpos


Question

Posted (edited)

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

11 answers to this question

Recommended Posts

  • 0
Posted

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
  • 0
Posted

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;
}

  • 0
Posted (edited)

is deja pe FLOAT, daca ar fi sa le pun pe varchar, in loc de:   if(sscanf(params, "ifff", jid, cposx, cposy, cposz))  ar fi   if(sscanf(params, "ivvv", jid, cposx, cposy, cposz)) ?

Edited by iSkull
  • 0
Posted

mda, dar pana la urma cum pot sa rezolv problmea comenzii? este trecuta tip FLOAT in tabel si mi se salveaza corect doar pozitiax iar celelalte 2 nu :(

  • 0
Posted

legatura este corecta, am si crashdetect si nativecheker si nu imi arata nimik, in afara de aceasta comanda restul merge bine

  • 0
Posted

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 :)

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.