10.05.2013, 11:43
(
Последний раз редактировалось lilt074life; 10.05.2013 в 13:04.
)
I have this command but it's bugged, can anyone fix it?
it's not showing me errors but I can't use it
it's not showing me errors but I can't use it
pawn Код:
dcmd_gedit(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 1337)
{
new
x_job[128],
gateid,
Float:ofloat,
string[128],
idx;
if(sscanf(params, "s[128]if", x_job, gateid, ofloat)) //
{
SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /gedit [option] [gateid]");
SendClientMessage(playerid, COLOR_GREY, "OPTIONS: object | close | open | speed | password");
return 1;
}
else if(strcmp(x_job, "object", true) == 0)
{
new object;
if(object == 0)
{
format(string, sizeof(string), "%d", object);
dcmd_deletegate(playerid, string);
return 1;
}
GateInfo[idx][gModel] = object;
DestroyDynamicObject(GateInfo[idx][gGate]);
GateInfo[idx][gGate] = CreateDynamicObject(GateInfo[idx][gModel], GateInfo[idx][gCX], GateInfo[idx][gCY], GateInfo[idx][gCZ], GateInfo[idx][gCRX], GateInfo[idx][gCRY], GateInfo[idx][gCRZ]);
format(string, sizeof(string), " You have set gate ID %d's object ID to %d.", idx, object);
SendClientMessage(playerid, COLOR_WHITE, string);
}
else if(strcmp(x_job, "close", true) == 0)
{
gEdit[playerid] = 1;
gEditID[playerid] = idx;
GetDynamicObjectPos(GateInfo[idx][gGate], gPos[playerid][0], gPos[playerid][1], gPos[playerid][2]);
GetDynamicObjectRot(GateInfo[idx][gGate], gRot[playerid][0], gRot[playerid][1], gRot[playerid][2]);
EditDynamicObject(playerid, GateInfo[idx][gGate]);
format(string, sizeof(string), " You are now editing gate ID %d's closing position.", idx);
SendClientMessage(playerid, COLOR_WHITE, string);
SaveGates();
}
else if(strcmp(x_job, "open", true) == 0)
{
gEdit[playerid] = 2;
gEditID[playerid] = idx;
GetDynamicObjectPos(GateInfo[idx][gGate], gPos[playerid][0], gPos[playerid][1], gPos[playerid][2]);
GetDynamicObjectRot(GateInfo[idx][gGate], gRot[playerid][0], gRot[playerid][1], gRot[playerid][2]);
EditDynamicObject(playerid, GateInfo[idx][gGate]);
format(string, sizeof(string), " You are now editing gate ID %d's opening position.", idx);
SendClientMessage(playerid, COLOR_WHITE, string);
}
else if(strcmp(x_job, "password", true) == 0)
{
new password[256];
format(GateInfo[idx][gPassword], 256, "%s", password);
format(string, sizeof(string), " You have set gate ID %d's password to {FF6347}%s", idx, password);
SendClientMessage(playerid, COLOR_WHITE, string);
}
else if(strcmp(x_job, "speed", true) == 0)
{
new Float:speed;
GateInfo[idx][gSpeed] = speed;
format(string, sizeof(string), " You have set gate ID %d's moving speed to %f.", idx, speed);
SendClientMessage(playerid, COLOR_WHITE, string);
}
}
return 1;
}