Loading job [MySQL]
#1

Here's my code: http://pastebin.com/QaYhw2KR

I need suggestion how to improve the current job system I have as I am new to pawn. But my problem right now is that the job is not being loaded upon restart. I have actors that are supposed to be created when jobs are loaded. Actors spawn when I create the jobs, but they aren't loading after a restart. This is my code, and OnGameModeInit I added LoadJobs();

How does this work with the actor by the way? Any way I can use "InRangeOfActor" ish thing to make a person able to use a command once the player is close to one of the actors and get the job id?

Using izcmd sscanf streamer.
Reply
#2

The LoadJobs has to be a function
(public LoadJobs etc)

Then in the query
(mysql_function_query(connection, query, true, "", "")

you have to use this:

mysql_function_query(connection, query, true, "LoadJobs", "");



Example:

PHP код:
forward LoadingJobs();
public 
LoadingJobs()
{
    if(
cache_num_rows)
    {
        while(
totaljobs cache_num_rows)
        {
            
id cache_get_row_int(totaljobs0);
            
jobData[id][jobtype] = cache_get_row_int(totaljobs1);
            
cache_get_row(totaljobs2jobData[id][jobname], connection24);
            
jobData[id][jobposx] = cache_get_row_float(totaljobs3);
            
jobData[id][jobposy] = cache_get_row_float(totaljobs4);
            
jobData[id][jobposz] = cache_get_row_float(totaljobs5);
            
jobData[id][jobposa] = cache_get_row_float(totaljobs6);
            
jobData[id][jobworld] = cache_get_row_int(totaljobs7);
            
jobData[id][actorskin] = cache_get_row_int(totaljobs8);
            
CreateActor(jobData[id][actorskin], jobData[id][jobposx], jobData[id][jobposy], jobData[id][jobposz], jobData[id][jobposa]);
            
totaljobs++;
            
printf("%d jobs loaded"totaljobs);
        }
    }
    return 
1;
}
stock LoadJobs()
{
    
format(querysizeof(query), "SELECT * FROM `jobs`");
    
mysql_function_query(connectionquerytrue"LoadingJobs""");
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)