SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 19/10/2019, 03:59 PM   #1
DarkWorldJack
Big Clucker
 
DarkWorldJack's Avatar
 
Join Date: Dec 2015
Location: Italy
Posts: 54
Reputation: 1
Default Safe Money Textdraw

ENG:
I have recently created a safe with textdraw, but when I increase or decrease the amount of money I want and go to confirm with 'SPACE' does not take away the difference of money.

ITA:
Ho creato recentemente una cassaforte con textdraw, peṛ quando aumento oppure diminuisco la quantità di denaro che desidero e vado per confermare con 'SPAZIO' non mi toglie la differenza del denaro.

PHP Code:
if (PREMI(KEY_SPRINT))
{
    if (
DenaroInPosesso[playerid] == getSOLDI(playerid)) HideMenuCassaforte(playerid);
    if ((
oldcash DenaroInCassaforte[playerid]) <= oldcash)
    {
         new 
denaro_prelevato = (oldcash DenaroInCassaforte[playerid]);

        
giveSOLDI(playeriddenaro_prelevato), Guadagno(playeriddenaro_prelevato00);
        
UserStat[playerid][cassaforte] -= denaro_prelevato;
    }
    
//Depositare
    
if ((getSOLDI(playerid)-DenaroInPosesso[playerid]) >= DenaroInPosesso[playerid])
    {
        new 
denaro_depositato = (getSOLDI(playerid) - DenaroInPosesso[playerid]);

        
Guadagno(playerid, -denaro_depositato00), takeSOLDI(playeriddenaro_depositato);
        
SetPlayerScore(playerid, (getSOLDI(playerid) - denaro_depositato));
        
UserStat[playerid][cassaforte] += denaro_depositato;
    }
    if ((
oldcash-DenaroInCassaforte[playerid]) >= UserStat[playerid][spazio_cassaforte])
    {
          new 
denaro_massimo = (UserStat[playerid][spazio_cassaforte] - oldcash);

        
ShowMexJob_Avv(playerid""red"La tua cassaforte e' piena!");
        
takeSOLDI(playeriddenaro_massimo), Guadagno(playerid, -denaro_massimo00);
        
UserStat[playerid][cassaforte] = UserStat[playerid][spazio_cassaforte];
    }
    
HideMenuCassaforte(playerid);
    
OnePlayAnim(playerid,"ROB_BANK","CAT_Safe_Rob",4.1,false,false,false,false,false,false);

DarkWorldJack is offline   Reply With Quote
Old 20/10/2019, 05:27 AM   #2
Vizi10
Huge Clucker
 
Join Date: May 2017
Location: Iran
Posts: 214
Reputation: 7
Default Re: Safe Money Textdraw

Did you use https://wiki.sa-mp.com/wiki/TextDrawSetString to update the textdraw info?
Vizi10 is offline   Reply With Quote
Old 21/10/2019, 08:49 PM   #3
DarkWorldJack
Big Clucker
 
DarkWorldJack's Avatar
 
Join Date: Dec 2015
Location: Italy
Posts: 54
Reputation: 1
Default Re: Safe Money Textdraw

Quote:
Originally Posted by Vizi10 View Post
Did you use https://wiki.sa-mp.com/wiki/TextDrawSetString to update the textdraw info?
The problem is about money, not about textdraw.
the problem is on the money I own

Concerning this string (maybe):
PHP Code:
 if ((getSOLDI(playerid)-DenaroInPosesso[playerid]) >= DenaroInPosesso[playerid])
    {
        new 
denaro_depositato = (getSOLDI(playerid) - DenaroInPosesso[playerid]);

        
Guadagno(playerid, -denaro_depositato00), takeSOLDI(playeriddenaro_depositato);
        
SetPlayerScore(playerid, (getSOLDI(playerid) - denaro_depositato));
        
UserStat[playerid][cassaforte] += denaro_depositato;
    } 
DarkWorldJack is offline   Reply With Quote
Old 28/10/2019, 10:21 AM   #4
DarkWorldJack
Big Clucker
 
DarkWorldJack's Avatar
 
Join Date: Dec 2015
Location: Italy
Posts: 54
Reputation: 1
Default Re: Safe Money Textdraw

Pleaseee help
DarkWorldJack is offline   Reply With Quote
Old 28/10/2019, 10:34 AM   #5
fiki574
Gangsta
 
fiki574's Avatar
 
Join Date: Mar 2011
Location: Croatia
Posts: 855
Reputation: 169
Default Re: Safe Money Textdraw

https://raw.githubusercontent.com/fi...ustomMoney.inc

EDIT:
Just realize my code is shit, so use with caution.
__________________
fiki574 is offline   Reply With Quote
Old 30/10/2019, 03:54 AM   #6
DarkWorldJack
Big Clucker
 
DarkWorldJack's Avatar
 
Join Date: Dec 2015
Location: Italy
Posts: 54
Reputation: 1
Default Re: Safe Money Textdraw

Quote:
Originally Posted by fiki574 View Post
https://raw.githubusercontent.com/fi...ustomMoney.inc

EDIT:
Just realize my code is shit, so use with caution.
no, I have a kind of safe and to confirm what I want to do, or to withdraw / deposit the money, I press Space, but to withdraw it works, but to deposit I don't scale the money, how can I solve?
DarkWorldJack is offline   Reply With Quote
Old 30/10/2019, 03:20 PM   #7
DarkWorldJack
Big Clucker
 
DarkWorldJack's Avatar
 
Join Date: Dec 2015
Location: Italy
Posts: 54
Reputation: 1
Default Re: Safe Money Textdraw

Quote:
Originally Posted by Mugala View Post
wtf? xd

OT: what is PREMI? is this code even called? make sure it's called first.
PREMI would be Press in Italian.

I don't need codes for now, I just need to understand what's wrong when I press SPACE to complete the operation, especially when I need to DEPOSIT the money
DarkWorldJack is offline   Reply With Quote
Old 30/10/2019, 04:06 PM   #8
Mugala
High-roller
 
Mugala's Avatar
 
Join Date: Nov 2012
Location: Georgia, Tbilisi
Posts: 1,109
Reputation: 67
Default Re: Safe Money Textdraw

how PREMI is defined? and also, add debugs in a code, like print or SendClientMessage..
__________________
Coding in 8 languages including Pawn, C#, C++ and SQL.
Available for hiring.

If you have a coding question or need an assistance in a code, just PM me.
If you want me to create something for you, here is a Discord Mugala#5651

Currently helping Community members in a coding.
Mugala is offline   Reply With Quote
Old 30/10/2019, 04:40 PM   #9
RoboN1X
Huge Clucker
 
RoboN1X's Avatar
 
Join Date: Feb 2011
Location: Indonesia
Posts: 378
Reputation: 87
Default Re: Safe Money Textdraw

I think you wanted a:
Code:
else if
I do not understand what you are trying to say, also the non english functions... but it seems that your issue when you press the space, it withdraws your money but not for deposit, could it be due to your money gets withdrawn again after deposit since you did not use ELSE condition?
__________________
Need Help? Use Search, WIKI, and FAQ
RoboN1X is offline   Reply With Quote
Old 01/11/2019, 09:00 PM   #10
DarkWorldJack
Big Clucker
 
DarkWorldJack's Avatar
 
Join Date: Dec 2015
Location: Italy
Posts: 54
Reputation: 1
Default Re: Safe Money Textdraw

Quote:
Originally Posted by RoboN1X View Post
I think you wanted a:
Code:
else if
I do not understand what you are trying to say, also the non english functions... but it seems that your issue when you press the space, it withdraws your money but not for deposit, could it be due to your money gets withdrawn again after deposit since you did not use ELSE condition?
I'll try, thanks
DarkWorldJack is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Textdraws Safe Money DarkWorldJack Scripting Help 12 11/09/2019 03:31 PM
Safe money object ID Ahmed21 Scripting Help 4 07/08/2016 11:07 AM
Set object 'money safe' Ercha Scripting Help 2 30/05/2014 04:04 AM


All times are GMT. The time now is 02:33 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.