Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: Finch on Apr 03, 2015, 04:48 AM

Title: WBStats
Post by: Finch on Apr 03, 2015, 04:48 AM
Hey guyz i add wbstats in my server but  they give me error on function register  on line these of wbstats
QuerySQL( sDB, "INSERT INTO BodyStats (Name, BodyParts) VALUES (%s'%i')", player.Name, "0 0 0 0 0 0 0)" );
QuerySQL( sDB, format( "REPLACE INTO WeaponStats (Name, Weps) VALUES ('%i')", player.Name, "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0" ) );     



And  error is sorry but i cant post screen shot due to reason

this is error
wrong number of parametes
Title: Re: WBStats
Post by: Thijn on Apr 03, 2015, 05:48 AM
You forgot the format function in the first QuerySQL.
Title: Re: WBStats
Post by: . on Apr 03, 2015, 05:51 AM
Quote from: Thijn on Apr 03, 2015, 05:48 AMYou forgot the format function in the first QuerySQL.

Not only that but also the "," is missing before and between those zeroes. And the inner double quotes aren't escaped.

Off: Would it kill you if you would use [-code] [-/code] tags? Seriously. Wtf is wrong with you?
Title: Re: WBStats
Post by: Thijn on Apr 03, 2015, 05:55 AM
@S.L.C. He's actually saving those zeroes with spaces in between, which in that case should be saved as a string not an integer.

Are you sure you want to save it that way Finch?
Title: Re: WBStats
Post by: . on Apr 03, 2015, 05:56 AM
@Thijn. Actually, hold on. His usage of the format function confused me. "(%s'%i'" there should be a "," between like "(%s, %i'". But why not use those zeroes directly in the query string? What's the point of formatting hard coded values?

And by the way, putting an %i when you specify a string of numbers, don't necessarily make them  a number.
Title: Re: WBStats
Post by: MacTavish on Apr 03, 2015, 06:41 AM
Actually the fault i've seen that format( is missing in BodyStats query maybe it is the problem

try this one
QuerySQL( sDB, format("INSERT INTO BodyStats (Name, BodyParts) VALUES (%s,'%i')", player.Name, "0 0 0 0 0 0 0") );
 
Title: Re: WBStats
Post by: . on Apr 03, 2015, 07:51 AM
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fs30.postimg.org%2F4r5n2e2w1%2Fimage.jpg&hash=c558cce77efaed886075c95070a2edba22d814ae)

(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fs14.postimg.org%2F9m9hogmv5%2Fimage.jpg&hash=5335c5085813ec0a955d93c5d6d494474052fa1b)

(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fs12.postimg.org%2F7frnwu32l%2Fimage.jpg&hash=e3045382133332fcc88b181b7eb93c25dc79f9cf)

(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fs7.postimg.org%2Fockz0dhez%2Fimage.jpg&hash=8899bb3a6c7168cacf7833cbf4778ef74c7d8458)

(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fs11.postimg.org%2F43mxk0fsz%2Fimage.jpg&hash=c65507c529aa965a25e731aa45d6056b75a9909f)

(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fs8.postimg.org%2Fqqk3a7w79%2Fimage.jpg&hash=c247543db0ebf84483a9cfef4ef2d902ad9dc453)

(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fs2.postimg.org%2Fvm95svo55%2Fimage.jpg&hash=e17fac70b055dd14a8bec85dcc642f507c819ce6)

MORAL OF THE STORY: RTFM