01.05.2013, 15:23
I've got a problem with gates password, so when I put the password and set it and try to /gate it says that it owns a password but when I type the password it doesn't open.. here's the codes:
And here's the gates part in /gate
pawn Код:
if(strcmp(cmd, "/setgatepass", true) == 0)
{
if(PlayerInfo[playerid][pAdmin] <= 0)
{
return SendClientMessage(playerid, COLOR_GREY," You're not authorized to use that command !");
}
new gateid;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
return SendClientMessage(playerid, COLOR_GREY," USAGE: /setgatepass [gateid] [password]");
}
gateid = strvalEx(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
return SendClientMessage(playerid, COLOR_GREY," USAGE: /setgatepass [gateid] [password]");
}
if(strlen(tmp) > 20)
{
return SendClientMessage(playerid, COLOR_GREY," Gate password can't be longer than 20 characters !");
}
strmid(GateInfo[gateid][gPass], tmp, 0, strlen(tmp), 23);
new reveal[256];
format(reveal, sizeof(reveal)," Gate ID %d's password has been set to '%s' !", gateid, tmp);
SendClientMessage(playerid, COLOR_GREY, reveal);
GateInfo[gateid][gPassed] = 1;
SaveGates();
return 1;
}
pawn Код:
for(new g=0;g<MAX_GATES;g++)
{
new Float:gaX, Float:gaY, Float:gaZ;
GetDynamicObjectPos(GateInfo[g][gID], gaX, gaY, gaZ);
if(IsPlayerInRangeOfPoint(playerid, GateInfo[g][gRange], gaX,gaY,gaZ))
{
if(GateInfo[g][gPassed])
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY," This gate is password protected !");
SendClientMessage(playerid, COLOR_WHITE," USAGE: /gate [pass]");
return 1;
}
if(strcmp(tmp, GateInfo[g][gPass], true) == 0)
{
if(gatedown[g] == 0)
{
if(GateInfo[g][gSpeed] == 0.0) { GateInfo[g][gSpeed] = 3; }
MoveDynamicObject(GateInfo[g][gID], GateInfo[g][gPosXM], GateInfo[g][gPosYM], GateInfo[g][gPosZM], GateInfo[g][gSpeed]);
gatedown[g] = 1;
return 1;
}
if(gatedown[g] != 0)
{
if(GateInfo[g][gSpeed] == 0.0) { GateInfo[g][gSpeed] = 3; }
MoveDynamicObject(GateInfo[g][gID], GateInfo[g][gPosX], GateInfo[g][gPosY], GateInfo[g][gPosZ], GateInfo[g][gSpeed]);
gatedown[g] = 0;
return 1;
}
}
else
{
return SendClientMessage(playerid, COLOR_GREY," Invalid password !");
}
}
if( (GateInfo[g][gFamily] == 255 && GateInfo[g][gFaction] == 0) ||
(GateInfo[g][gFamily] != 0 && PlayerInfo[playerid][pFMember]+1 == GateInfo[g][gFamily]) ||
(GateInfo[g][gFaction] != 0 && PlayerInfo[playerid][pMember] == GateInfo[g][gFaction]) ||
GateInfo[g][gHID] == PlayerInfo[playerid][pPhousekey] ||
PlayerInfo[playerid][pAdmin] >= 1339)
{
if(gatedown[g] == 0)
{
if(GateInfo[g][gSpeed] == 0.0) { GateInfo[g][gSpeed] = 3; }
MoveDynamicObject(GateInfo[g][gID], GateInfo[g][gPosXM], GateInfo[g][gPosYM], GateInfo[g][gPosZM], GateInfo[g][gSpeed]);
gatedown[g] = 1;
return 1;
}
if(gatedown[g] == 1)
{
if(GateInfo[g][gSpeed] == 0.0) { GateInfo[g][gSpeed] = 3; }
MoveDynamicObject(GateInfo[g][gID], GateInfo[g][gPosX], GateInfo[g][gPosY], GateInfo[g][gPosZ], GateInfo[g][gSpeed]);
gatedown[g] = 0;
return 1;
}
}
else
{
return SendClientMessage(playerid, COLOR_GREY," You don't have the remote for this gate !");
}
}
else
{
if(g < MAX_GATES)
{
continue;
}
else
{
return SendClientMessage(playerid, COLOR_GREY," You're not near to any gate");
}
}
}
return 1;
}