PHP код:
CMD:editgate(playerid, params[])
{
new file[256], pass[256];
pass = dini_Get(file, "Password");
new Float:speed = 0;
if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, -1, "USAGE:/editgate <speed || password || autogate || open || close>");
if(!strcmp(params, "speed", true, 5))
{
new i;
if(HowManyGatesNearPlayer(playerid) == 0) return SendClientMessage(playerid, -1, "You arn't near any gate");
i = WhichGateIsNearPlayer(playerid);
format(file, sizeof(file), GATE_PATH, i);
if(sscanf(params, "s[128]f", params, speed)) return SendClientMessage(playerid, -1, "USAGE:/editgate speed <speed>");
GInfo[i][Speed] = speed;
dini_FloatSet(file, "Speed", speed);
SendClientMessage(playerid, -1, "Gate's speed changed.");
}
if(!strcmp(params, "password", true, 8))
{
new i;
if(HowManyGatesNearPlayer(playerid) == 0) return SendClientMessage(playerid, -1, "You arn't near any gate");
i = WhichGateIsNearPlayer(playerid);
format(file, sizeof(file), GATE_PATH, i);
new pas[256];
if(sscanf(params, "s[128]s[256]", params, pas)) return SendClientMessage(playerid, -1, "USAGE:/editgate password <password>");
GInfo[i][Password] = pas;
dini_Set(file, "Password", pas);
SendClientMessage(playerid, -1, "Gate's password changed");
}
if(!strcmp(params, "autogate", true, 8))
{
new i;
if(HowManyGatesNearPlayer(playerid) == 0) return SendClientMessage(playerid, -1, "You arn't near any gate");
i = WhichGateIsNearPlayer(playerid);
format(file, sizeof(file), GATE_PATH, i);
new option;
if(sscanf(params, "s[128]i", params, option)) return SendClientMessage(playerid, -1, "USAGE:/editgate autogate <1=ON || 0= OFF>");
if(!strcmp(GInfo[i][Password], "None", true, 4))
{
GInfo[i][Autogate] = option;
dini_IntSet(file, "Autogate", option);
SendClientMessage(playerid, -1, "Gate's autogate has been changed.");
}else{
return SendClientMessage(playerid, -1, "You can't set autogate for a gate that have password.");
}
}
if(!strcmp(params, "open", true, 4))
{
SelectObject(playerid);
open[playerid] = true;
close[playerid] = false;
SendClientMessage(playerid, -1, "You are changing open postion for gate.");
}
if(!strcmp(params, "close", true, 5))
{
SelectObject(playerid);
open[playerid] = false;
close[playerid] = true;
SendClientMessage(playerid, -1, "You are changing close postion for gate.");
}
return 1;
}