SA-MP Forums Archive
Dynamic System [Important] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Dynamic System [Important] (/showthread.php?tid=439305)



Dynamic System [Important] - zT KiNgKoNg - 24.05.2013

I don't know whats wrong at all...



pawn Код:
CMD:buyhotdog(playerid, params[])
{
    for(new i; i < MAX_HDSTANDS; i++)
    {
        if(IsPlayerInRangeOfPoint(playerid, 3, HotDogStands[i][Hds_X], HotDogStands[i][Hds_Y], HotDogStands[i][Hds_Z]))
        {
            if(pData[playerid][StaffLevel] >=1)
            {
                SendClientMessage(playerid,-1,"[Admin]: *Mexican Accent*: Welcome to the adminhotdog stand");
            }
        }
    }
    return 1;
}
CMD:createhotdogstand(playerid, params[])
{

    if(pData[playerid][StaffLevel] >=6)
    {
        new sBuyPrice, sSellPrice,sHotdogPrice,Float:P_X,Float:P_Y,Float:P_Z;
        if(sscanf(params, "dd" , sBuyPrice, sSellPrice, sHotdogPrice)) return SendClientMessage(playerid, -1,"Syntax: /createhotdogstand [Buy Price] [Sell Price] [Hotdog Price]");
       
        GetPlayerPos(playerid,P_X,P_Y,P_Z);
        format(Query,sizeof(Query),"INSERT INTO `DynamicHotdogStands` (Hds_X,Hds_Y,Hds_Z,Products,HotDogPrice,BuyPrice,SellPrice,Owner) VALUES('%f','%f','%f','%d','%d','%d','%d','%s')",P_X,P_Y,P_Z,0,sHotdogPrice,sBuyPrice,sSellPrice,"The State");
        mysql_query(Query);
        SendClientMessage(playerid,-1,"Hotdog Stand Created, Reloading and adding now!");
        ReloadHotdogStands();
       
    } else {
   
   
    }
    return 1;
}

stock ReloadHotdogStands()
{
    for(new id; id < MAX_HDSTANDS; id++)
    {
        DestroyDynamicObject(FoodStallHotdog[id]);
    }
    return LoadHotdogStands();
}

stock LoadHotdogStands()
{
    //
    for(new id; id < MAX_HDSTANDS; id++)
    {
        format(Query, sizeof(Query), "SELECT * FROM `DynamicHotdogStands` WHERE ID = %d", id);
        mysql_query(Query);
        mysql_store_result();
        if(mysql_num_rows())
       
        if(mysql_fetch_row_format(Query,"|"))
        {
             sscanf(Query, "e<p<|>dfffdddds[100]>",HotDogStands[id]);
             FoodStallHotdog[id] = CreateDynamicObject(1340, HotDogStands[id][Hds_X],HotDogStands[id][Hds_Y],HotDogStands[id][Hds_Z], 0.0, 0.0, 0.0, 100);
             printf("Hotdog Stand [%d] - Owner: %s",id,HotDogStands[id][Owner]);
        }
       
    }
    return 1;
}



Re: Dynamic System [Important] - Hernando - 25.05.2013

What seems to be the problem?


Re: Dynamic System [Important] - zT KiNgKoNg - 25.05.2013

The, Objects aren't loading into the game.


Re: Dynamic System [Important] - mahdi499 - 25.05.2013

im pretty sure this
pawn Код:
if(sscanf(params, "dd" , sBuyPrice, sSellPrice, sHotdogPrice)) return SendClientMessage(playerid, -1,"Syntax:  /createhotdogstand [Buy Price] [Sell Price] [Hotdog Price]");
should be
pawn Код:
if(sscanf(params, "ddd" , sBuyPrice, sSellPrice, sHotdogPrice)) return SendClientMessage(playerid, -1,"Syntax:  /createhotdogstand [Buy Price] [Sell Price] [Hotdog Price]");



Re: Dynamic System [Important] - zT KiNgKoNg - 26.05.2013

Wrong, Thats inserting into the database not loading, laughing my ass off due to your lack of looking.