Jump to content
  • 0

T/C


StefanAdv

Question

4 answers to this question

Recommended Posts

  • 0
2 hours ago, Stefan said:

CMD:createobj(playerid, params[]) {
    //if(PlayerInfo[playerid][pPin] != 0 && PinLogged[playerid] == 0) return SCM(playerid, COLOR_YELLOW, "Pentru a folosi aceasta comanda trebuie sa-ti introduci condul de securitate {FFFFFF}(/loginpin).");
    if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to login first.");
    if(IsPlayerConnected(playerid))
    {
        if(PlayerInfo[playerid][pAdmin] >= 7)
        {
            new query[256], Float:pX,Float:pY,Float:pZ,idobj,model,string[128];
            if(sscanf(params, "d", model)) return SendClientMessage(playerid, 0xFFFFFFFF, "{FFFFFF}Syntaxa: /createobj <model>");
            {
                new i = idobj+1;
                GetPlayerPos(playerid, pX, pY, pZ);
                ObjectInfo[objID] = i;
                ObjectInfo[objPosX] = pX;
                ObjectInfo[objPosY] = pY;
                 ObjectInfo[objPosZ] = pZ;
                 ObjectInfo[objModel] = model;
                mysql_format(SQL, query, sizeof(query), "UPDATE `eventobjects` SET `objPosX`='%f',`objPosY`='%f',`objPosZ`='%f',`objModel`='%d' WHERE `objID`='%d'",pX,pY,pZ,model,i);
                mysql_tquery(SQL,query,"","");
                LoadQuest();
                format(string ,sizeof(string), "Objectul cu id %d a fost creat cu succes!",model);
                SCM(playerid, COLOR_YELLOW, string);
            }
        }
        else return SendClientMessage(playerid, COLOR_ERROR, AdminOnly);
    }
    return 1;
}

Poza Salvare baza de date Quest: https://imgur.com/a/hVsMO

Dau sa se criereze si imi apare textul ca a fost creat dar nu se pune in baza de date si nu apare nimic pe sv.

 

Functia LoadQuest

forward LoadQuest();
public LoadQuest()
{
    questobjectss = cache_num_rows();
    for(new i = 1; i <= questobjectss; i++)
    {
        new s = i - 1;
        ObjectInfo[objModel]                     = cache_get_field_content_int(s, "objModel");
        ObjectInfo[objID]                         = cache_get_field_content_int(s, "objID");
        ObjectInfo[objPosX]                        = cache_get_field_content_float(s, "objPosX");
        ObjectInfo[objPosY]                        = cache_get_field_content_float(s, "objPosY");
        ObjectInfo[objPosZ]                        = cache_get_field_content_float(s, "objPosZ");
    }
    printf("[LOADING] %d quest objects loaded.", questobjectss);
}

Daca vrei sa introduci date noi in baza de date te folosesti de INSERT in nici-un caz de UPDATE, el se foloseste pentru a actualiza datele deja existente in baza de date.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • 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.