Destroying a dynamic object. -
TheSnaKe - 23.12.2014
Hello there, when am destroying the ATM and restarting the server, the object won't be deleted why? I guess it won't save so that's why it won't be deleted. How can i fix that.
PHP код:
}
if(dialogid == 52)
{
if(response)
{
new tmpid = IsPlayerAtATM(playerid);
if(tmpid!=-1)
{
new path[32];
format(path,sizeof(path),"atm%d.txt",tmpid);
dini_Remove(path);
Delete3DTextLabel(atmInfo[tmpid][aText]);
DestroyDynamicObject(atmInfo[tmpid][aObject]);
atmInfo[tmpid][aX]=0.0;
atmInfo[tmpid][aY]=0.0;
atmInfo[tmpid][aZ]=0.0;
atmInfo[tmpid][aA]=0.0;
//SendClientMessage(playerid, COLOR_GREY,"ATM ID: %d destroyed successfully",tmpid);
new string[128];
format(string, sizeof(string), "{FF0000}[Admin Warn]{FF6347} %s has destroyed an ATM", RPN(playerid));
SendAdminMessage(COLOR_DARKRED, 1, string);
return 1;
} else return 0;
}
else
{
SendClientMessage(playerid, COLOR_GREY,"Destroying ATM canceled");
return 1;
}
}
if(dialogid == 51)
{
if(response)
{
new Float:Pos[4];
GetPlayerPos(playerid,Pos[0],Pos[1],Pos[2]);
GetPlayerFacingAngle(playerid,Pos[3]);
//new atmid = CreateATM(Pos[0],Pos[1],Pos[2],Pos[3]);
CreateATM(Pos[0],Pos[1],Pos[2],Pos[3]);
//SendClientMessage(playerid, COLOR_GREY,"ATM ID: %d successfully created", atmid);
new string[128];
format(string, sizeof(string), "{FF0000}[Admin Warn]{FF6347} %s has created an ATM", RPN(playerid));
SendAdminMessage(COLOR_DARKRED, 1, string);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY,"Creating ATM canceled");
return 1;
}
The command:
PHP код:
}
CMD:deleteatm(playerid, params[])
{
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(PlayerInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
{
new tmpid = IsPlayerAtATM(playerid);
if(tmpid!=-1)
{
new stringa[MAX_STRING];
format(stringa,sizeof(stringa),"Are you sure you want to destroy ATM ID: %d",tmpid);
ShowPlayerDialog(playerid,52,DIALOG_STYLE_MSGBOX,"ATM destroy",stringa,"Yes","No");
return 1;
} else return SendClientMessage(playerid, COLOR_GREY,"You are not at ATM");
}
}
Re: Destroying a dynamic object. -
TheSnaKe - 23.12.2014
Is there any way to fix this? Sorry for double post.
Re: Destroying a dynamic object. -
Schneider - 23.12.2014
Does the IsPlayerAtATM-function actually return the Atm's ID or just 0 (if not) or 1 (if player is at atm)?
Re: Destroying a dynamic object. -
TheSnaKe - 23.12.2014
Atm's ID
Re: Destroying a dynamic object. -
Schneider - 23.12.2014
Does the file get deleted when you destroy the Atm?
Re: Destroying a dynamic object. -
TheSnaKe - 23.12.2014
Quote:
Originally Posted by Schneider
Does the file get deleted when you destroy the Atm?
|
Nope.
Re: Destroying a dynamic object. -
Schneider - 23.12.2014
Try to add some debug-prints between each line, reload the server, try to delete an ATM as usual then open your serverlog.txt and see what gets printed and what not:
pawn Код:
if(dialogid == 52)
{
print("Dialog 52 called");
if(response)
{
print("Respones = 1");
new tmpid = IsPlayerAtATM(playerid);
printf("Current ATM ID: %d", tmpid);
if(tmpid!=-1)
{
print("ID is NOT -1)"
new path[32];
format(path,sizeof(path),"atm%d.txt",tmpid);
printf("Trying to delete file: %s", path");
dini_Remove(path);
print("File removed");