Problems Loading Pickups
#1

I made a system to load pickups from a mysql database to make stores. It refuses to work.

BT: I did put LoadSQLShops(); under ongamemode init.

pawn Код:
forward LoadSQLShops(pickupid);

enum StoreInfo
{
    Float:sX,
    Float:sY,
    Float:sZ
}

new sInfo[MAX_PICKUPS][StoreInfo];


COMMAND:addstore(playerid,params[])
{
    new query[100];
    new
        Float: X,
        Float: Y,
        Float: Z;
    GetPlayerPos(playerid, X, Y, Z);
    format(query, sizeof(query), "INSERT INTO `stores` (`X`, `Y`, `Z`) VALUES ('%d', '%d', '%d');",X, Y, Z);
    mysql_query(query);
    return 1;
}

stock LoadSQLShops(pickupid)
{
    mysql_query("SELECT * FROM `stores`");
    mysql_store_result();

    new Query[256], X, Y, Z;
    if(mysql_num_rows() > 0)
    {
        while(mysql_fetch_field(Query, "|"))
        {
            sscanf(Query, "p<|>fff", X, Y, Z);
            new store = CreatePickup(1274,23,X, Y, Z);
            sInfo[pickupid][sX] = X;
            sInfo[pickupid][sY] = Y;
            sInfo[pickupid][sZ] = X;
        }
    {
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == store)
    {
        SendClientMessage(playerid, COLOR_YELLOW, "Shops are under construction!");
    }
    return 1;
}
Reply
#2

First of all, you can make a stock from it. You're not using it as an callback that's being called.
forwards/publics are callbacks, used for eg. timers or to check for eg. updated (OnPlayerUpdate, OnPlayerConnect, etc). And I don't think you'll need to use 'LoadSQLShops' in a timer, or check something.
Try that first (making a stock from it).
And I can't help you futher by the way, because I don't work with samp SQL.
Reply
#3

Changed it to stock but still wont load and errors on compile.
Reply
#4

Can you show me the errors? Maybe I know what's wrong then
Reply
#5

C:\Users\Nickolas\Desktop\PWn\Server\gamemodes\bus .pwn(262) : warning 202: number of arguments does not match definition
C:\Users\Nickolas\Desktop\PWn\Server\gamemodes\bus .pwn(1894) : warning 204: symbol is assigned a value that is never used: "string"
C:\Users\Nickolas\Desktop\PWn\Server\gamemodes\bus .pwn(2829) : warning 204: symbol is assigned a value that is never used: "store"
C:\Users\Nickolas\Desktop\PWn\Server\gamemodes\bus .pwn(2829 -- 2834) : warning 217: loose indentation
C:\Users\Nickolas\Desktop\PWn\Server\gamemodes\bus .pwn(2829 -- 2836) : warning 217: loose indentation
C:\Users\Nickolas\Desktop\PWn\Server\gamemodes\bus .pwn(2836) : error 029: invalid expression, assumed zero
C:\Users\Nickolas\Desktop\PWn\Server\gamemodes\bus .pwn(2836) : error 004: function "OnPlayerPickUpPickup" is not implemented
C:\Users\Nickolas\Desktop\PWn\Server\gamemodes\bus .pwn(283 : error 017: undefined symbol "store"
C:\Users\Nickolas\Desktop\PWn\Server\gamemodes\bus .pwn(2840) : error 017: undefined symbol "playerid"
C:\Users\Nickolas\Desktop\PWn\Server\gamemodes\bus .pwn(2844) : error 030: compound statement not closed at the end of file (started at line 2826)
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


5 Errors.


ITs weird, when i comment line LoadSQLStores(); in OnGamemodeInit it does not error, but then it would not be told to load. :S
Reply
#6

Plz someone help.
Reply
#7

It's not in that script.
The "store" (if(pickupid) == store) doesn't exists, OnPlayerPickupPickUp doesn't 'exists'?
I think you've forgotten a bracket somewhere in your script. Re-check all line (except if it's a very big script)
Reply
#8

Its a big script nearing 3000 lines. Maybe tv me?
Reply
#9

Then you'd better send me the code via PM (upload at www.pastebin.com and make it "private" so public can't see it).
But can't you check it out yourself? Just go look at places you'd just edit
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)