hi im working on ECD ( European city dolor ) i'm little bit confused
i want convert dolors to ecd i just want that function which can check the amount and convert it to ecd
like 1 ecd = 10000$ if i type /ecd 1 it decrease the cash if i type /ecd 2 it decrease more cash and convert it
Why copy paste?
And as well, it's the wrong board.
here's an example anyways:-
local amount = 2;
player.Cash -= 10000*amount;
Quote from: KAKAN on Aug 29, 2016, 08:38 AMWhy copy paste?
And as well, it's the wrong board.
here's an example anyways:-
local amount = 2;
player.Cash -= 10000*amount;
sry if i post in wrong section btw i'm still confused can you explain little bit more about this code plus how this code can help
if i type /ecd 10 30
sure.
take this as an example command:-
http://pastebin.com/NSeRqzzT
Now, just by seeing, you can understand it.
:edit: I just saw that you PM'ed me with a message that you're weak in English, so, read this message( written in hindi ):
pehele ham ye dekh rahe hen ki wo kuch value dia hey ya nahi aur agar dia hai toh wo ek number hey ya nahi. Agar he toh, ham uska money check kar rahe hen, agar kam he to, usko kuch nahi milega, aur agar theek hey to, phir usko uska ECDs mil jayega.
NOTE:- I'm not good in hindi though
Dude my english isn't weak enough O.o
btw
Thanks kakan this example help a lot :D problem almost solved just 1 thing left
i saved ecd in database in db the ecd are updating but not in game you have to rejoin the server for updating
+
i got this error
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fi68.tinypic.com%2Fa3z9eb.png&hash=05df3667f9ba489207c7813942836f38ff8bba7f)
else if( cmd == "ecd" )
{
if(!text) return MessagePlayer( "[#FF0000][ERROR] - [#F7FE2E] Added soon.", player );
else if( !IsNum( text ) ) return MessagePlayer( "[#FF0000][ERROR] - [#F7FE2E]added soon .", player );
else {
//Convert the text to integer.
text = text.tointeger();
//The required cash.
local newamount = 100*text;
//Check if the player has sufficient money or not.
if( player.Cash < newamount ) return MessagePlayer( "[#FF0000][ERROR] - [#F7FE2E]added soon.", player );
//tell the message.
MessagePlayer("You've got " + text + " ECDs for exchange of: $" + newamount , player );
DecCash( player, newamount );
//Give them the ECD somehow.
Incecd(player, text )
}
}
here my cmd
Line?
Quote from: EK.CrystalBlue on Aug 29, 2016, 11:15 AMLine?
it does not show the line number or any error just appeared this
Quote from: Nihongo^ on Aug 29, 2016, 11:29 AMQuote from: EK.CrystalBlue on Aug 29, 2016, 11:15 AMLine?
it does not show the line number or any error just appeared this
Try removing the try catch lines from your onPlayerCommand function.
Maybe you dont have inc ecd and dec ecd functions
Quote from: Xmair on Aug 29, 2016, 11:34 AMQuote from: Nihongo^ on Aug 29, 2016, 11:29 AMQuote from: EK.CrystalBlue on Aug 29, 2016, 11:15 AMLine?
it does not show the line number or any error just appeared this
Try removing the try catch lines from your onPlayerCommand function.
Thanks xmair its work here's the bug
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fi63.tinypic.com%2F2dik07c.png&hash=53fd0ee188732486c5b120e9c3d8a9452e148a97)
Line 152
Quoteplayer.VC = PlayerVC( player );
player.VC doesnt in the squirrel plugin, and you cant add it because player returning new instance every time for some reason
Quote from: EK.CrystalBlue on Aug 29, 2016, 12:33 PMplayer.VC doesnt in the squirrel plugin, and you cant add it because player returning new instance every time for some reason
lol?
Add this to the top of your script:-
CPlayer.rawnewmember( "VC", 0, null, false );
You're done now :)
Quote from: KAKAN on Aug 29, 2016, 12:49 PMQuote from: EK.CrystalBlue on Aug 29, 2016, 12:33 PMplayer.VC doesnt in the squirrel plugin, and you cant add it because player returning new instance every time for some reason
lol?
Add this to the top of your script:-
CPlayer.rawnewmember( "VC", 0, null, false );
You're done now :)
Thanks kakan for your reply
but
what is CPlayer ? and how this function belongs to my VC function
Quote from: Nihongo^ on Aug 29, 2016, 12:54 PMQuote from: KAKAN on Aug 29, 2016, 12:49 PMQuote from: EK.CrystalBlue on Aug 29, 2016, 12:33 PMplayer.VC doesnt in the squirrel plugin, and you cant add it because player returning new instance every time for some reason
lol?
Add this to the top of your script:-
CPlayer.rawnewmember( "VC", 0, null, false );
You're done now :)
Thanks kakan for your reply
but
what is CPlayer ? and how this function belongs to my VC function
Well, the instance player which you use belongs to the CPlayer class. And that class contains all your functions in the player's instance.
You're using player.VC, and the 'VC' variable doesn't exist. So, you need to add it to the class yourself.
Quote from: KAKAN on Aug 29, 2016, 01:00 PMQuote from: Nihongo^ on Aug 29, 2016, 12:54 PMQuote from: KAKAN on Aug 29, 2016, 12:49 PMQuote from: EK.CrystalBlue on Aug 29, 2016, 12:33 PMplayer.VC doesnt in the squirrel plugin, and you cant add it because player returning new instance every time for some reason
lol?
Add this to the top of your script:-
CPlayer.rawnewmember( "VC", 0, null, false );
You're done now :)
Thanks kakan for your reply
but
what is CPlayer ? and how this function belongs to my VC function
Well, the instance player which you use belongs to the CPlayer class. And that class contains all your functions in the player's instance.
You're using player.VC, and the 'VC' variable doesn't exist. So, you need to add it to the class yourself.
Thanks kakan i will try it but 1 thing left
i saved ecd in database in db the ecd are updating but not in game you have to rejoin the server for updating
Quote from: Nihongo^ on Aug 29, 2016, 01:17 PMi saved ecd in database in db the ecd are updating but not in game you have to rejoin the server for updating
simply update your variable. Show me how you update it in-game. Add the same function to your Inc, Dec ECD function(s).
Quote from: KAKAN on Aug 29, 2016, 03:16 PMQuote from: Nihongo^ on Aug 29, 2016, 01:17 PMi saved ecd in database in db the ecd are updating but not in game you have to rejoin the server for updating
simply update your variable. Show me how you update it in-game. Add the same function to your Inc, Dec ECD function(s).
Variable mean in database ?
btw here;'s my function that show the ECD
show <- CreateTextdraw("Vice Coins | " + GetSQLColumnData( QuerySQL( db, "SELECT VC FROM Account WHERE Name='" + player.Name + "'" ), 0 ) + "",10,-30,Colors[ rand() % Colors.len() ]);
You manually need to delete and re-create it.
Quote from: KAKAN on Aug 29, 2016, 03:53 PMYou manually need to delete and re-create it.
recreate the table ??
Quote from: Nihongo^ on Aug 29, 2016, 04:05 PMQuote from: KAKAN on Aug 29, 2016, 03:53 PMYou manually need to delete and re-create it.
recreate the table ??
no, the textdraw.
Here's an example:-
data <- array( 100 );
function onPlayerJoin( player ){
local ddraw = CreateTextdraw("Vice Coins | " + GetSQLColumnData( QuerySQL( db, "SELECT VC FROM Account WHERE Name='" + player.Name + "'" ), 0 ) + "",10,-30,Colors[ rand() % Colors.len() ]);
data[ player.ID ] = ddraw; //Using arrays, you can store a lot more!
}
function IncECD( player, amount ){
//Your code.
//newecd is no of ECDs the player is having currently( increased one )
data[ player.ID ].Delete();
data[ player.ID ] = CreateTextdraw("Vice Coins | " + newecd + "",10 ,-30,Colors[ rand() % Colors.len() ]);
}
Thanks kakan this example help a lot :D
problem solved Thanks Again :D