Delete ATM
#1

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;
} 
Reply
#2

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.
Reply
#3

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
Reply
#4

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


Forum Jump:


Users browsing this thread: 1 Guest(s)