SA-MP Forums Archive
Mysl problem - 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: Mysl problem (/showthread.php?tid=612443)



Mysl problem - ,TomY' - 17.07.2016

Hi. When I using this code its works great:
Code:
                Player.exp[pid]+=100;
                mysql_function_query(DbHandle, f("UPDATE players SET exp = (exp+'100') WHERE Name = '%s'",GetPlayerNameEx(pid)), true, "SendQuery", "");
I wana that code would add not 100 xp, but random. So i have this code, but it doesn't work..

HTML Code:
      new eexp = RandomEx(90,300);
                Player.exp[pid]+=eexp;
                mysql_function_query(DbHandle, f("UPDATE players SET exp = (exp+'eexp') WHERE Name = '%s'",GetPlayerNameEx(pid)), true, "SendQuery", "");
Why? : /


Re: Mysl problem - Misiur - 18.07.2016

Your "f" function looks suspicious. Can you show us what it does?


Re: Mysl problem - [cS]Owain - 18.07.2016

Use this
Quote:
new eexp = RandomEx(90,300);

Player.exp[pid]+=eexp;

mysql_function_query(DbHandle, f("UPDATE players SET exp = (exp+%d) WHERE Name = '%s'", eexp, GetPlayerNameEx(pid)), true, "SendQuery", "");