SA-MP Forums Archive
Delete ATM - 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: Delete ATM (/showthread.php?tid=658742)



Delete ATM - AlfaSufaIndo - 11.09.2018

I have a script to make an atm.
But I don't have a script to delete atm, how do I create a script to delete the ATM?
Please help me, because I don't really know about DINI
PHP код:
CMD:createatm(playerid, params[])
{
    new 
String[10000];
    if(
PlayerInfo[playerid][pAdmin] >= 7)
     {
        new 
NewATMID = SpawnedATM+1;
        if(
NewATMID >= MAX_ATM)
        {
            
SendClientMessage( playerid, COLOR_WHITE, "Too many ATMs are currently spawned!");
        }
        new 
Float:x, Float:y, Float:z;
        
GetPlayerPos(playerid, x, y, z);
        
format( String, sizeof( String ), "ARWIN14ATM/ATM_%d.ini", NewATMID);
        if(
dini_Exists(String))
        {
            
SpawnedATM++;
             
format( String, sizeof( String ), "ATM (ID: %d) already exist!", NewATMID);
               
SendClientMessage( playerid, COLOR_GREY, String);
             
SendClientMessage( playerid, COLOR_YELLOW, "Please try again by typing /createatm complete" );
           }
        else
           {
            
ATMInfo[NewATMID][ATMX] = x;
            
ATMInfo[NewATMID][ATMY] = y;
            
ATMInfo[NewATMID][ATMZ] = z;
            
ATMInfo[NewATMID][ATMAngle] = 0;
            
ATMInfo[NewATMID][ATMFee] = 1;
            
dini_Create(String);
            
dini_IntSet( String, "Fee", ATMInfo[NewATMID][ATMFee]);
            
dini_FloatSet( String, "X", ATMInfo[NewATMID][ATMX]);
            
dini_FloatSet( String, "Y", ATMInfo[NewATMID][ATMY]);
            
dini_FloatSet( String, "Z", ATMInfo[NewATMID][ATMZ]);
            
dini_FloatSet( String, "Angle", ATMInfo[NewATMID][ATMAngle]);
            
SpawnedATM++;
            
ATMInfo[NewATMID][ATMObjectID] = CreateDynamicObject(19201, ATMInfo[NewATMID][ATMX], ATMInfo[NewATMID][ATMY], ATMInfo[NewATMID][ATMZ]-0.5, 0, 0, ATMInfo[NewATMID][ATMAngle],-1,-1,-1,250);
            
format(String, sizeof(String), "[id:%d]\n{FFFFFF}use command '{FF0000}/atm{FFFFFF}' to acces ATM",NewATMID);
            
atm[NewATMID] = CreateStreamed3DTextLabel(String, COLOR_WHITE, ATMInfo[NewATMID][ATMX], ATMInfo[NewATMID][ATMY], ATMInfo[NewATMID][ATMZ], 10.0, 0);
               
SendClientMessage( playerid, COLOR_LIGHTBLUE, "ATM berhasil dibuat!" );
            
format(String, sizeof( String ), "ID ATM baru: %d.", NewATMID);
            
SendClientMessage(playerid, COLOR_WHITE, String);
            
SetTimerEx("simpenmaxlimit", 1000, 0, "d", playerid);
        }
    }
     else
    {
        
SendClientMessage( playerid, COLOR_GREY, "You are not authorized to use this command!" );
    }
    return 
1;
} 



Re: Delete ATM - AzaMx - 11.09.2018

PHP код:
COMMAND:deleteatm(playerid, params[])
{
    new 
atmid;
    if(
PlayerInfo[playerid][pAdmin] >= 7) return SendClientMessage( playerid, COLOR_GREY, "You are not authorized to use this command!" );
    if( 
sscanf ( params, "d", atmid)) return SendClientMessage( playerid, COLOR_GREY, "/deleteatm [atm id]" );
    new 
string[64];
    
format(string,sizeof(string),"ARWIN14ATM/ATM_%d.ini",atmid);
    if(!
dini_Exists(string)) return SendClientMessage( playerid, COLOR_GREY, "There's no ATM with this ID!" );
    
dini_Remove(string);
    
DestroyDynamicObject(ATMInfo[NewATMID][ATMObjectID]);
    
DestroyDynamic3DTextLabel(ATMInfo[NewATMID][ATMText]);
    return 
1;
} 
something like that, just change it to your code.


Re: Delete ATM - AlfaSufaIndo - 11.09.2018

Quote:
Originally Posted by AzaMx
Посмотреть сообщение
PHP код:
COMMAND:deleteatm(playerid, params[])
{
    new 
atmid;
    if(
PlayerInfo[playerid][pAdmin] >= 7) return SendClientMessage( playerid, COLOR_GREY, "You are not authorized to use this command!" );
    if( 
sscanf ( params, "d", atmid)) return SendClientMessage( playerid, COLOR_GREY, "/deleteatm [atm id]" );
    new 
string[64];
    
format(string,sizeof(string),"ARWIN14ATM/ATM_%d.ini",atmid);
    if(!
dini_Exists(string)) return SendClientMessage( playerid, COLOR_GREY, "There's no ATM with this ID!" );
    
dini_Remove(string);
    
DestroyDynamicObject(ATMInfo[NewATMID][ATMObjectID]);
    
DestroyDynamic3DTextLabel(ATMInfo[NewATMID][ATMText]);
    return 
1;
} 
something like that, just change it to your code.
Okay,, i'll try it thanks


Re: Delete ATM - AlfaSufaIndo - 11.09.2018

Oh yeah, i forgot something.. So when i create an atm... it create 3D TextLabel.. but not create the object.. idk why