#emit crash
#1

Why does this works
PHP код:
main()
{
    new 
t;
    
#emit LOAD.S.pri    t
    #emit PUSH.pri
    #emit PUSH.C         4
    #emit SYSREQ.C         SetWorldTime
    #emit LCTRL         4
    #emit LOAD.S.alt     8
    #emit ADD
    #emit SCTRL         4

But changing this line
PHP код:
new t
to this
PHP код:
new 19
doesn't work and shows this:
Quote:

[debug] Run time error 6: "Invalid instruction"
[debug] Unknown opcode 0x1300 at address 0x00000013
[debug] AMX backtrace:
[debug] #0 00000013 in main () from <unknown>
Script[gamemodes/z/t.amx]: Run time error 6: "Invalid instruction"

What opcode should I use to pass the var?
Reply
#2

You don't even need to know emit for writing simple gamemode, just make every system simple and working. Only usage for emit is formated send client messages what saves you code writing time.
Reply
#3

On short: I'm trying to call format with variables from an array (and it's not working so I tried somthing smaller)

Long story:

Problem: Loading player's data from multiple DB tables across multiple files in my GM
Fix: Create a file named load with a single big query
Problem 2: There is quite a bit of data to load + this means I have to split my systems (load part will be ripped off)
Fix 2: A callback through all files. Each system send it's query to the DB (note that I need a counter to know when everything loaded).

This is the method I'm using right now and I want to change it. Why? Take a look at how it works https://pastebin.com/Pbzi2eWp

There is too much code I need to repeat every time + there are too many callbacks regarding the login system
(I have OnPlayerLoad which is called just to format the queries and then call other callback to load the data;
OnAccountLoad which is the callback from this query "SELECT * FROM users WHERE id=x";
OnUserFound which load basic things such as the player ID from 'names' table (yes, I have a names table),
the admin level in case the server is open just for admins and the ban status (don't load anything until I check those))
and I try to reduce this number.

Fix: Have a string which contains the model of all the queries (like this: "SELECT * FROM users WHERE id=%i; SELECT admin FROM admins WHERE id=%i; SELECT ..")
Each system calls a function which concatenate their query to the string (under OnGameModeInit). When the palyer's data can be loaded,
format the query and send it. Now I don't know how to format the query: https://pastebin.com/Q42Ra7qn
Reply
#4

If I were you, I'd load the very basics (main table and admins table) and all the rest should be loaded with a delay unless it's necessary upon logging in to do something with these values (in example, spawning to previous location).

Now there are some ideas I can think of, such as JOINs, multi-statements (R40 version and above) and storing the cache.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)