10.02.2013, 16:51
How to make gate editing easy? Than i can with mouse chose open and close possition.
Like it is in Liberty City RolePlay.
Like it is in Liberty City RolePlay.
PHP код:
if(strcmp(cmd, "/editgate", true) == 0)
{
if(PlayerInfo[playerid][pAdmin] < 1339)
{
return SendClientMessage(playerid, COLOR_GREY," You're not authorized to use that command !");
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid,COLOR_GREY," USAGE: /editgate [gate id] [name]");
SendClientMessage(playerid,COLOR_GREY," Available names : location, family, faction");
return 1;
}
new gateid = strvalEx(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid,COLOR_GREY," USAGE: /editgate [gate id] [name]");
SendClientMessage(playerid,COLOR_GREY," Available names : location, family, faction");
return 1;
}
if(strcmp(tmp, "location", true) == 0)
{
if(gateid >= 0 && gateid < MAX_GATES)
{
new Float:playaX, Float:playaY, Float:playaZ, Float:playaA;
GetPlayerPos(playerid, playaX, playaY, playaZ);
GetPlayerFacingAngle(playerid, playaA);
GateInfo[gateid][gX] = playaX;
GateInfo[gateid][gY] = playaY;
GateInfo[gateid][gZ] = playaZ;
GateInfo[gateid][gRot] = playaA;
DestroyDynamicObject(GateInfo[gateid][gID]);
GateInfo[gateid][gID] = CreateDynamicObject(980, GateInfo[gateid][gX], GateInfo[gateid][gY], GateInfo[gateid][gZ]+1.75, 0.0,0.0, playaA);
new locstr[256];
format(locstr,sizeof(locstr)," Changed location for gate ID %d !", gateid);
SendClientMessage(playerid, COLOR_GREY, locstr);
SaveGates();
return 1;
}
else
{
return SendClientMessage(playerid, COLOR_GREY, "Invalid gate ID !");
}
}
else if(strcmp(tmp, "family", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strval(tmp))
{
return SendClientMessage(playerid, COLOR_GREY," USAGE: /editgate [gateid] family [familyid]");
}
new dingdingdong = strvalEx(tmp);
if(gateid >= 0 && gateid < MAX_GATES)
{
if(dingdingdong < 1 || dingdingdong > 14)
{
return SendClientMessage(playerid, COLOR_GREY," Valid family IDs : 1-14 ");
}
GateInfo[gateid][gFamily] = dingdingdong-1;
new famstr[256];
format(famstr,sizeof(famstr)," Gave family %d permissions to gate %d.", dingdingdong, gateid);
SendClientMessage(playerid, COLOR_GREY, famstr);
SaveGates();
return 1;
}
else
{
return SendClientMessage(playerid, COLOR_GREY, "Invalid gate ID !");
}
}
else if(strcmp(tmp, "faction", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strval(tmp))
{
return SendClientMessage(playerid, COLOR_GREY," USAGE: /editgate [gateid] faction [familyid]");
}
new dingdingdong = strvalEx(tmp);
if(gateid >= 0 && gateid < MAX_GATES)
{
if(dingdingdong < 1 || dingdingdong > 10)
{
return SendClientMessage(playerid, COLOR_GREY," Valid faction IDs : 1-10 ");
}
GateInfo[gateid][gFaction] = dingdingdong;
new facstr[256];
format(facstr,sizeof(facstr)," Gave faction %d permissions to gate %d.", dingdingdong, gateid);
SendClientMessage(playerid, COLOR_GREY, facstr);
SaveGates();
return 1;
}
else
{
return SendClientMessage(playerid, COLOR_GREY, "Invalid gate ID !");
}
}
return 1;
}
PHP код:
if(strcmp(cmd, "/creategate", true) == 0)
{
if(PlayerInfo[playerid][pAdmin] >= 1339)
{
new Float:ppX,
Float:ppY,
Float:ppZ;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, "USAGE: /creategate [name] [value]");
SendClientMessage(playerid, COLOR_GREY, "Available names: location, locationm(opened), complete");
return 1;
}
if(strcmp(tmp, "location", true) == 0)
{
GetPlayerPos(playerid, ppX, ppY, ppZ);
ggX[playerid] = ppX; ggY[playerid] = ppY; ggZ[playerid] = ppZ;
SendClientMessage(playerid, COLOR_GREY," Coordinates saved for gate location !");
return 1;
}
else if(strcmp(tmp, "complete", true) == 0)
{
for(new g=0;g<MAX_GATES;g++)
{
if(GateInfo[g][gPosX] == 0.0)
{
if(ggX[playerid] != 0.0)
{
if(ggXM[playerid] != 0.0)
{
GateInfo[g][gPosX] = ggX[playerid];
GateInfo[g][gPosY] = ggY[playerid];
GateInfo[g][gPosZ] = ggZ[playerid]+1.7;
GateInfo[g][gPosXM] = ggXM[playerid];
GateInfo[g][gPosYM] = ggYM[playerid];
GateInfo[g][gPosZM] = ggZM[playerid];
GateInfo[g][gModel] = 980;
GateInfo[g][gRange] = 10;
GateInfo[g][gSpeed] = 3;
strmid(GateInfo[g][gPass],"", 0, 0, 23);
GateInfo[g][gPassed] = 0;
CreateGate(g);
//GateInfo[g][gID] = CreateDynamicObject(980, ggX[playerid], ggY[playerid], ggZ[playerid]+1.75, 0.0,0.0, 0.0);
new gatestr[256];
format(gatestr,sizeof(gatestr)," Gate ID %d created successfully ! Use /editgate to personalise it.", g);
SendClientMessage(playerid, COLOR_GREY,gatestr);
SaveGates();
return 1;
}
else
{
return SendClientMessage(playerid, COLOR_GREY," You haven't defined the open gate position ! ( /creategate locationm )");
}
}
else
{
return SendClientMessage(playerid, COLOR_GREY," You haven't defined the gate position ! ( /creategate location )");
}
}
else
{
continue;
}
}
}
else if(strcmp(tmp, "locationm", true) == 0)
{
GetPlayerPos(playerid, ppX, ppY, ppZ);
ggXM[playerid] = ppX; ggYM[playerid] = ppY; ggZM[playerid] = ppZ;
SendClientMessage(playerid, COLOR_GREY," Coordinates saved for opened gate location !");
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, "USAGE: /creategate [name]");
SendClientMessage(playerid, COLOR_GREY, "Available names: location, complete");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD2, "You are not authorized to use that command!");
return 1;
}
return 1;
}