Well I know that I made about 2 or 3 posts about this but sorry, I really can't find the solution and the guys who helped me, it again gets bugged.
Well I have that I can create in game faction gate, but when I create it, player which is not in faction or in faction can just come and /movegate [any pass]. So I want if you can help me make that only that faction member can move gate that gate. I have that when I create for faction gate, that faction member can move it with pressing 'Y' or typing /gate. Can you please help me?
/movegate
/editgate ( creating gates)
Well I have that I can create in game faction gate, but when I create it, player which is not in faction or in faction can just come and /movegate [any pass]. So I want if you can help me make that only that faction member can move gate that gate. I have that when I create for faction gate, that faction member can move it with pressing 'Y' or typing /gate. Can you please help me?
/movegate
Code:
CMD:movegate(playerid, params[])
{
new pw[64];
if(sscanf(params, "s[64]", pw)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /movegate [Password(Case Sensitive)]");
for(new gt =1; gt <MAX_GATES; gt++)
if(PlayerInfo[playerid][pFMember] != 0)
{
if(Gates[gt][GateCreated] == 1)
{
if(IsPlayerInRangeOfPoint(playerid, Gates[gt][GateRadius], Gates[gt][GateX], Gates[gt][GateY], Gates[gt][GateZ]))
{
if(!strcmp(pw, Gates[gt][GatePW], false))
{
if(Gates[gt][GateStatus] == 0)
{
MoveDynamicObject(Gates[gt][GateObject], Gates[gt][MveGateX], Gates[gt][MveGateY], Gates[gt][MveGateZ], Gates[gt][GateSpeed], Gates[gt][MveGateRotX], Gates[gt][MveGateRotY], Gates[gt][MveGateRotZ]);
Gates[gt][GateStatus] = 1;
}
else
{
MoveDynamicObject(Gates[gt][GateObject], Gates[gt][GateX], Gates[gt][GateY], Gates[gt][GateZ], Gates[gt][GateSpeed], Gates[gt][GateRotX], Gates[gt][GateRotY], Gates[gt][GateRotZ]);
Gates[gt][GateStatus] = 0;
}
}
else
{
SendClientMessage(playerid, -1, "Who do you think you are! Password is wrong!");
}
}
}
}
return 1;
}
/editgate ( creating gates)
Code:
CMD:editgate(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 4 || PlayerInfo[playerid][pDev] >= 2 || PlayerInfo[playerid][pMapper] == MAPPERRANK_MANAGER)
{
new action[24], optional;
if(!sscanf(params, "s[24]F(0.0)", action, optional))
{
if(!strcmp(action, "create", true))
{
new objid, tempgid, bool:found = false;
if(!sscanf(params, "s[24]i", action, objid))
{
if(IsAValidGateObject(objid))
{
for(new i =1; i <=MAX_GATES; i++)
{
if(Gates[i][GateCreated] == 0)
{
tempgid = i;
found = true;
break;
}
}
if(found)
{
new Float:x, Float:y, Float:z, vw, inter;
GetPlayerPos(playerid, x, y, z);
vw = GetPlayerVirtualWorld(playerid);
inter = GetPlayerInterior(playerid);
EditingGate[playerid] = tempgid;
strmid(sendername, PlayerICName(playerid), 0, MAX_PLAYER_NAME);
Gates[tempgid][GateBy] = sendername;
Gates[tempgid][GateObjectID] = objid;
Gates[tempgid][GateX] = x +1;
Gates[tempgid][GateY] = y +1;
Gates[tempgid][GateZ] = z;
Gates[tempgid][GateRotX] = 0;
Gates[tempgid][GateRotY] = 0;
Gates[tempgid][GateRotZ] = 0;
Gates[tempgid][GateVW] = vw;
Gates[tempgid][GateINT] = inter;
Gates[tempgid][GateStatus] = 0;
Gates[tempgid][Faction] = 0;
CreateGate(tempgid);
Streamer_Update(playerid);
format(str, sizeof(str), "You have succesfully spawned gate(%d) at your current position.", tempgid);
SendClientMessage(playerid, COLOR_GRAD1, str);
format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s has spawned gate(%d) at their position.", PlayerICName(playerid), tempgid);
ABroadCast(COLOR_WHITE, str, 1);
}
else
{
SendClientMessage(playerid, COLOR_DARKRED, "ERROR: Max gates reached.");
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "Invalid object ID.");
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /editgate create [OBJECTID]");
SendClientMessage(playerid, COLOR_GRAD1, "Door object IDs: 2955 (regular), 3089 (with windows), 2949 ('keep locked'), 1498 (white door).");
SendClientMessage(playerid, COLOR_GRAD1, "Door object IDs: 1536 (modern door; black, yellow), 1535 (pink apartment).");
SendClientMessage(playerid, COLOR_GRAD2, "Garage object IDs: 10558 (old), 2957 (regular), 3037 (warehouse), 7709 (modern).");
SendClientMessage(playerid, COLOR_GRAD3, "Gate object IDs: 3049 (red, barb wired), 3036 ('keep locked'), 2930 (door gate), 975 (long, rails).");
SendClientMessage(playerid, COLOR_GRAD3, "Gate Object IDs: 989 (airport gate), 966 (barrier base), 968 (barrier).");
}
}
else if(!strcmp(action, "id", true))
{
new gateid;
if(!sscanf(params, "s[24]i", action, gateid))
{
if(gateid == 0 || gateid > MAX_GATES) return SendClientMessage(playerid, COLOR_GRAD1, "Invalid gate ID.");
if(Gates[gateid][GateCreated] == 1)
{
EditingGate[playerid] = gateid;
format(str, sizeof(str), "You are now editing gate(%d).", EditingGate[playerid]);
SendClientMessage(playerid, COLOR_GRAD1, str);
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "Invalid gate ID.");
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /editgate id [GATEID]");
}
}
else if(!strcmp(action, "faction", true))
{
if(EditingGate[playerid] != 0)
{
new
faction;
if(sscanf(params, "s[24]i", action, faction))
return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /editgate [faction id]");
if(!(faction > -1))
return SendClientMessage(playerid, COLOR_GREY, "Invalid faction ID.");
Gates[EditingGate[playerid]][Faction] = faction;
format(str, sizeof(str), "You have successfully changed gate(%d)'s faction to %d.", EditingGate[playerid], faction);
SendClientMessage(playerid, COLOR_GREY, str);
}
}
else if(!strcmp(action, "object", true))
{
if(EditingGate[playerid] != 0)
{
new objid;
if(!sscanf(params, "s[24]i", action, objid))
{
if(IsAValidGateObject(objid))
{
DestroyDynamicObject(Gates[EditingGate[playerid]][GateObject]);
Gates[EditingGate[playerid]][GateObject] = 0;
Gates[EditingGate[playerid]][GateObjectID] = objid;
CreateGate(EditingGate[playerid]);
format(str, sizeof(str), "You have succesfully changed gate(%d)'s object to %d.", EditingGate[playerid], objid);
SendClientMessage(playerid, COLOR_GRAD1, str);
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "Invalid object ID.");
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /editgate object [OBJECTID]");
}
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "You are not editing any gate.");
}
}
else if(!strcmp(action, "position", true))
{
if(EditingGate[playerid] != 0)
{
GateAction[playerid] = EDITING_GATE_POSITION;
EditDynamicObject(playerid, Gates[EditingGate[playerid]][GateObject]);
format(str, sizeof(str), "You are now editing gate(%d)'s position.", EditingGate[playerid]);
SendClientMessage(playerid, COLOR_GRAD1, str);
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "You are not editing any gate.");
}
}
else if(!strcmp(action, "oposition", true))
{
if(EditingGate[playerid] != 0)
{
GateAction[playerid] = EDITING_GATE_OPOSITION;
EditDynamicObject(playerid, Gates[EditingGate[playerid]][GateObject]);
format(str, sizeof(str), "You are now editing gate(%d)'s opened position.", EditingGate[playerid]);
SendClientMessage(playerid, COLOR_GRAD1, str);
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "You are not editing any gate.");
}
}
else if(!strcmp(action, "speed", true))
{
if(EditingGate[playerid] != 0)
{
new Float:newspeed;
if(!sscanf(params, "s[24]f", action, newspeed))
{
if(newspeed < 0.001 || newspeed > 10) return SendClientMessage(playerid, COLOR_GRAD1, "Speed must be between 0.001 or 10 seconds per unit.");
Gates[EditingGate[playerid]][GateSpeed] = newspeed;
format(str, sizeof(str), "Gate(%d)'s Speed was succesfully adjust to %f seconds/unit.", EditingGate[playerid], newspeed);
SendClientMessage(playerid, COLOR_GRAD1, str);
}
else
{
SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /editgate speed [NEWSPEED(Seconds/unit)]");
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "You are not editing any gate.");
}
}
else if(!strcmp(action, "radius", true))
{
if(EditingGate[playerid] != 0)
{
new Float:newradii;
if(!sscanf(params, "s[24]f", action, newradii))
{
if(newradii < 1 || newradii > 15) return SendClientMessage(playerid, COLOR_GRAD1, "Radius must be between 1 or 15 units.");
Gates[EditingGate[playerid]][GateRadius] = newradii;
format(str, sizeof(str), "Gate(%d)'s Radius was succesfully adjust to %f units.", EditingGate[playerid], newradii);
SendClientMessage(playerid, COLOR_GRAD1, str);
}
else
{
SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /editgate radius [NEWRADIUS(in units)]");
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "You are not editing any gate.");
}
}
else if(!strcmp(action, "houseid", true))
{
if(EditingGate[playerid] != 0)
{
new hid;
if(!sscanf(params, "s[24]i", action, hid))
{
if(HouseInfo[hid][hCreated] == 1)
{
Gates[EditingGate[playerid]][GateHouseID] = HouseInfo[hid][hSQLID];
format(str, sizeof(str), "Gate(%d) was succesfully connected to house %i.", EditingGate[playerid], hid);
SendClientMessage(playerid, COLOR_GRAD1, str);
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "Invalid house ID.");
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /editgate houseid [HOUSEID(to connect the gate to)]");
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "You are not editing any gate.");
}
}
else if(!strcmp(action, "delete", true))
{
if(EditingGate[playerid] != 0)
{
DestroyDynamicObject(Gates[EditingGate[playerid]][GateObject]);
Gates[EditingGate[playerid]][GateObject] = 0;
strmid(Gates[EditingGate[playerid]][GateBy], "", 0, strlen("None"), 255);
Gates[EditingGate[playerid]][GateCreated] = 0;
Gates[EditingGate[playerid]][GateObjectID] = 0;
Gates[EditingGate[playerid]][GateX] = 0;
Gates[EditingGate[playerid]][GateY] = 0;
Gates[EditingGate[playerid]][GateZ] = 0;
Gates[EditingGate[playerid]][GateRotX] = 0;
Gates[EditingGate[playerid]][GateRotY] = 0;
Gates[EditingGate[playerid]][GateRotZ] = 0;
Gates[EditingGate[playerid]][GateVW] = 0;
Gates[EditingGate[playerid]][GateINT] = 0;
Gates[EditingGate[playerid]][MveGateX] = 0;
Gates[EditingGate[playerid]][MveGateX] = 0;
Gates[EditingGate[playerid]][MveGateX] = 0;
Gates[EditingGate[playerid]][GateSpeed] = 0;
Gates[EditingGate[playerid]][GateRadius] = 0;
Gates[EditingGate[playerid]][GateHouseID] = 0;
Gates[EditingGate[playerid]][GateStatus] = 0;
format(str, sizeof(str), "You have deleted gate(%d).", EditingGate[playerid]);
SendClientMessage(playerid, COLOR_GRAD1, str);
format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s has deleted gate(%d).", PlayerICName(playerid), EditingGate[playerid]);
ABroadCast(COLOR_WHITE, str, 1);
EditingGate[playerid] = 0;
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "You are not editing any gate.");
}
}
else if(!strcmp(action, "reload", true))
{
if(EditingGate[playerid] != 0)
{
new gid = EditingGate[playerid];
DestroyDynamicObject(Gates[gid][GateObject]);
Gates[gid][GateObject] = CreateDynamicObject(Gates[gid][GateObjectID], Gates[gid][GateX], Gates[gid][GateY], Gates[gid][GateZ], Gates[gid][GateRotX], Gates[gid][GateRotY], Gates[gid][GateRotZ], Gates[gid][GateVW], Gates[gid][GateINT]);
format(str, sizeof(str), "You have reloaded gate(%d).", EditingGate[playerid]);
SendClientMessage(playerid, COLOR_GRAD1, str);
format(str, sizeof(str), "{FF0000}AdmWarning{FFFFFF}: %s has reloaded gate(%d).", PlayerICName(playerid), EditingGate[playerid]);
ABroadCast(COLOR_WHITE, str, 1);
EditingGate[playerid] = 0;
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "You are not editing any gate.");
}
}
else if(!strcmp(action, "stop", true))
{
if(EditingGate[playerid] != 0)
{
SendClientMessage(playerid, COLOR_GRAD1, "Editing progress was ended.");
EditingGate[playerid] = 0;
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "You are not editing any gate.");
}
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "Invalid action.");
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /editgate [action]");
SendClientMessage(playerid, COLOR_GREY, "Available actions: create, id, object, position, oposition, speed, houseid, radius, delete, stop, reload");
SendClientMessage(playerid, COLOR_GREY, "Available actions: faction");
}
}
else
{
AdmErrorMsg;
}
return 1;
}