PDA

View Full Version : Help.Cmds bugged


Strech
22/06/2012, 07:51 AM
Why when i /ddedit or /gedit tome The server shuts down?

[MM]RoXoR[FS]
22/06/2012, 08:18 AM
Do you mind showing your codes.

Strech
22/06/2012, 08:23 AM
CMD:ddedit(playerid, params[])
{
if(PlayerInfo[playerid][pAdminDuty] == 0) return SendClientMessage(playerid, -1, "You must be on Admin Duty to use this Command!");
if(PlayerInfo[playerid][pAdmin] < 4)
{
SendClientMessageEx(playerid, COLOR_GRAD2, "You are not authorized to use that command!");
return 1;
}

new string[128], choice[32], doorid, amount;
if(sscanf(params, "s[32]dD", choice, doorid, amount))
{
SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /ddedit [name] [doorid] [amount]");
SendClientMessageEx(playerid, COLOR_GREY, "Available names: Exterior, Interior, CustomInterior, CustomExterior, VIP");
SendClientMessageEx(playerid, COLOR_GREY, "Family, Faction, Wanted, Admin, VehicleAble, Color, PickupModel, Delete");
return 1;
}

if(doorid >= MAX_DDOORS)
{
SendClientMessageEx( playerid, COLOR_WHITE, "Invalid Door ID!");
return 1;
}

if(strcmp(choice, "interior", true) == 0)
{
GetPlayerPos(playerid, DDoorsInfo[doorid][ddInteriorX], DDoorsInfo[doorid][ddInteriorY], DDoorsInfo[doorid][ddInteriorZ]);
GetPlayerFacingAngle(playerid, DDoorsInfo[doorid][ddInteriorA]);
DDoorsInfo[doorid][ddInteriorInt] = GetPlayerInterior(playerid);
DDoorsInfo[doorid][ddInteriorVW] = GetPlayerVirtualWorld(playerid);
SendClientMessageEx(playerid, COLOR_WHITE, "You have changed the interior!");
SaveDynamicDoors();
format(string, sizeof(string), "%s has edited DoorID %d's Interior.", GetPlayerNameEx(playerid), doorid);
Log("logs/ddedit.log", string);
return 1;
}
else if(strcmp(choice, "custominterior", true) == 0)
{
if(DDoorsInfo[doorid][ddCustomInterior] == 0)
{
DDoorsInfo[doorid][ddCustomInterior] = 1;
SendClientMessageEx(playerid, COLOR_WHITE, "Door set to custom interior!");
}
else
{
DDoorsInfo[doorid][ddCustomInterior] = 0;
SendClientMessageEx(playerid, COLOR_WHITE, "Door set to normal (not custom) interior!");
}
SaveDynamicDoors();
format(string, sizeof(string), "%s has edited DoorID %d's CustomInterior.", GetPlayerNameEx(playerid), doorid);
Log("logs/ddedit.log", string);
return 1;
}
else if(strcmp(choice, "customexterior", true) == 0)
{
if(DDoorsInfo[doorid][ddCustomExterior] == 0)
{
DDoorsInfo[doorid][ddCustomExterior] = 1;
SendClientMessageEx(playerid, COLOR_WHITE, "Door set to custom exterior!");
}
else
{
DDoorsInfo[doorid][ddCustomExterior] = 0;
SendClientMessageEx(playerid, COLOR_WHITE, "Door set to normal (not custom) exterior!");
}
SaveDynamicDoors();
format(string, sizeof(string), "%s has edited DoorID %d's CustomExterior.", GetPlayerNameEx(playerid), doorid);
Log("logs/ddedit.log", string);
return 1;
}
else if(strcmp(choice, "exterior", true) == 0)
{
GetPlayerPos(playerid, DDoorsInfo[doorid][ddExteriorX], DDoorsInfo[doorid][ddExteriorY], DDoorsInfo[doorid][ddExteriorZ]);
GetPlayerFacingAngle(playerid, DDoorsInfo[doorid][ddExteriorA]);
DDoorsInfo[doorid][ddExteriorVW] = GetPlayerVirtualWorld(playerid);
DDoorsInfo[doorid][ddExteriorInt] = GetPlayerInterior(playerid);
SendClientMessageEx(playerid, COLOR_WHITE, "You have changed the exterior!");
if(IsValidDynamicPickup(DDoorsInfo[doorid][ddPickupID])) DestroyDynamicPickup(DDoorsInfo[doorid][ddPickupID]);
if(IsValidDynamic3DTextLabel(DDoorsInfo[doorid][ddTextID])) DestroyDynamic3DTextLabel(DDoorsInfo[doorid][ddTextID]);
CreateDynamicDoor(doorid);
SaveDynamicDoors();
format(string, sizeof(string), "%s has edited DoorID %d's Exterior.", GetPlayerNameEx(playerid), doorid);
Log("logs/ddedit.log", string);
}
else if(strcmp(choice, "vip", true) == 0)
{
DDoorsInfo[doorid][ddVIP] = amount;

format(string, sizeof(string), "You have changed the VIP Level to %d.", amount);
SendClientMessageEx(playerid, COLOR_WHITE, string);

SaveDynamicDoors();
format(string, sizeof(string), "%s has edited DoorID %d's VIP Level.", GetPlayerNameEx(playerid), doorid);
Log("logs/ddedit.log", string);
return 1;
}
else if(strcmp(choice, "family", true) == 0)
{
DDoorsInfo[doorid][ddFamily] = amount;

format(string, sizeof(string), "You have changed the Family to %d.", amount);
SendClientMessageEx(playerid, COLOR_WHITE, string);

SaveDynamicDoors();
format(string, sizeof(string), "%s has edited DoorID %d's Family.", GetPlayerNameEx(playerid), doorid);
Log("logs/ddedit.log", string);
return 1;
}
else if(strcmp(choice, "faction", true) == 0)
{
DDoorsInfo[doorid][ddFaction] = amount;

format(string, sizeof(string), "You have changed the Faction to %d.", amount);
SendClientMessageEx(playerid, COLOR_WHITE, string);

SaveDynamicDoors();
format(string, sizeof(string), "%s has edited DoorID %d's Faction.", GetPlayerNameEx(playerid), doorid);
Log("logs/ddedit.log", string);
return 1;
}
else if(strcmp(choice, "admin", true) == 0)
{
DDoorsInfo[doorid][ddAdmin] = amount;

format(string, sizeof(string), "You have changed the Admin Level to %d.", amount);
SendClientMessageEx(playerid, COLOR_WHITE, string);

SaveDynamicDoors();
format(string, sizeof(string), "%s has edited DoorID %d's Admin Level.", GetPlayerNameEx(playerid), doorid);
Log("logs/ddedit.log", string);
return 1;
}
else if(strcmp(choice, "wanted", true) == 0)
{
DDoorsInfo[doorid][ddWanted] = amount;

format(string, sizeof(string), "You have changed the Wanted to %d.", amount);
SendClientMessageEx(playerid, COLOR_WHITE, string);

SaveDynamicDoors();
format(string, sizeof(string), "%s has edited DoorID %d's Wanted.", GetPlayerNameEx(playerid), doorid);
Log("logs/ddedit.log", string);
return 1;
}
else if(strcmp(choice, "vehicleable", true) == 0)
{
DDoorsInfo[doorid][ddVehicleAble] = amount;

format(string, sizeof(string), "You have changed the VehicleAble to %d.", amount);
SendClientMessageEx(playerid, COLOR_WHITE, string);

SaveDynamicDoors();
format(string, sizeof(string), "%s has edited DoorID %d's VehicleAble.", GetPlayerNameEx(playerid), doorid);
Log("logs/ddedit.log", string);
return 1;
}
else if(strcmp(choice, "color", true) == 0)
{
DDoorsInfo[doorid][ddColor] = amount;

format(string, sizeof(string), "You have changed the Color to %d.", amount);
SendClientMessageEx(playerid, COLOR_WHITE, string);

if(IsValidDynamicPickup(DDoorsInfo[doorid][ddPickupID])) DestroyDynamicPickup(DDoorsInfo[doorid][ddPickupID]);
if(IsValidDynamic3DTextLabel(DDoorsInfo[doorid][ddTextID])) DestroyDynamic3DTextLabel(DDoorsInfo[doorid][ddTextID]);
CreateDynamicDoor(doorid);

SaveDynamicDoors();
format(string, sizeof(string), "%s has edited DoorID %d's Color.", GetPlayerNameEx(playerid), doorid);
Log("logs/ddedit.log", string);
return 1;
}
else if(strcmp(choice, "pickupmodel", true) == 0)
{
DDoorsInfo[doorid][ddPickupModel] = amount;

format(string, sizeof(string), "You have changed the PickupModel to %d.", amount);
SendClientMessageEx(playerid, COLOR_WHITE, string);

if(IsValidDynamicPickup(DDoorsInfo[doorid][ddPickupID])) DestroyDynamicPickup(DDoorsInfo[doorid][ddPickupID]);
if(IsValidDynamic3DTextLabel(DDoorsInfo[doorid][ddTextID])) DestroyDynamic3DTextLabel(DDoorsInfo[doorid][ddTextID]);
CreateDynamicDoor(doorid);

SaveDynamicDoors();
format(string, sizeof(string), "%s has edited DoorID %d's PickupModel.", GetPlayerNameEx(playerid), doorid);
Log("logs/ddedit.log", string);
return 1;
}
else if(strcmp(choice, "delete", true) == 0)
{
if (DDoorsInfo[doorid][ddDescription] == 0) {
format(string, sizeof(string), "DoorID %d does not exist.", doorid);
SendClientMessageEx(playerid, COLOR_WHITE, string);
return 1;
}
if(IsValidDynamicPickup(DDoorsInfo[doorid][ddPickupID])) DestroyDynamicPickup(DDoorsInfo[doorid][ddPickupID]);
DestroyDynamic3DTextLabel(DDoorsInfo[doorid][ddTextID]);
DDoorsInfo[doorid][ddDescription] = 0;
DDoorsInfo[doorid][ddCustomInterior] = 0;
DDoorsInfo[doorid][ddExteriorVW] = 0;
DDoorsInfo[doorid][ddExteriorInt] = 0;
DDoorsInfo[doorid][ddInteriorVW] = 0;
DDoorsInfo[doorid][ddInteriorInt] = 0;
DDoorsInfo[doorid][ddExteriorX] = 0;
DDoorsInfo[doorid][ddExteriorY] = 0;
DDoorsInfo[doorid][ddExteriorZ] = 0;
DDoorsInfo[doorid][ddExteriorA] = 0;
DDoorsInfo[doorid][ddInteriorX] = 0;
DDoorsInfo[doorid][ddInteriorY] = 0;
DDoorsInfo[doorid][ddInteriorZ] = 0;
DDoorsInfo[doorid][ddInteriorA] = 0;
DDoorsInfo[doorid][ddCustomExterior] = 0;
DDoorsInfo[doorid][ddVIP] = 0;
DDoorsInfo[doorid][ddFamily] = 0;
DDoorsInfo[doorid][ddFaction] = 0;
DDoorsInfo[doorid][ddAdmin] = 0;
DDoorsInfo[doorid][ddWanted] = 0;
DDoorsInfo[doorid][ddVehicleAble] = 0;
DDoorsInfo[doorid][ddColor] = 0;
DDoorsInfo[doorid][dPass] = 0;
DDoorsInfo[doorid][dLocked] = 0;
SaveDynamicDoors();
format(string, sizeof(string), "You have deleted DoorID %d.", doorid);
SendClientMessageEx(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "%s has deleted DoorID %d.", GetPlayerNameEx(playerid), doorid);
Log("logs/ddedit.log", string);
return 1;
}
return 1;
}