Jump to content
Autentificarea cu Google și Facebook nu mai este disponibilă. ×

Question

4 answers to this question

Recommended Posts

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

  • 0
Posted
Acum 2 ore, Stefan a spus:

Vreau T/C am rezolvat , Multumesc!

Cum ai facut ?am si aceiasi problema ..in loc de update ce ai pus?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 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.