code
I Have a problem that only id 0 can use this cmd
plzz help me fixing it
Code:
CMD:gate(playerid, params[])
{
// Gates
new name[MAX_PLAYER_NAME+1];
GetPlayerName(playerid, name, sizeof(name));
new done;
for(new idx=1; idx<MAX_GATES; idx++)
{
new Float:cur[3];
if(GateInfo[idx][gModel])
{
GetDynamicObjectPos(GateInfo[idx][gGate], cur[0], cur[1], cur[2]);
if(IsPlayerInRangeOfPoint(playerid, 8, cur[0], cur[1], cur[2]) || IsPlayerInRangeOfPoint(playerid, 8, GateInfo[idx][gCX], GateInfo[idx][gCY], GateInfo[idx][gCZ]) || IsPlayerInRangeOfPoint(playerid, 8, GateInfo[idx][gOX], GateInfo[idx][gOY], GateInfo[idx][gOZ]))
{
if(GateInfo[idx][gOwner] != name[playerid]) return SendClientMessage(playerid, red,"ERROR: You are not owner of this gate to use this command or you are not close to a gate1");
if(strlen(GateInfo[idx][gPassword]))
{
if(sscanf(params, "s[256]", params)) return SendClientMessage(playerid, 0xFFFFFF00, "{58D3F7}USAGE: {FFDC2E}/gate [password]");
if(strcmp(params, GateInfo[idx][gPassword])) return SendClientMessage(playerid, -1, "{FF0000}Invalid gate password.");
if(!GateInfo[idx][gStatus])
{
GateInfo[idx][gStatus] = 1;
MoveDynamicObject(GateInfo[idx][gGate], GateInfo[idx][gOX], GateInfo[idx][gOY], GateInfo[idx][gOZ], GateInfo[idx][gSpeed], GateInfo[idx][gORX], GateInfo[idx][gORY], GateInfo[idx][gORZ]);
done=1;
break;
}
else
{
GateInfo[idx][gStatus] = 0;
MoveDynamicObject(GateInfo[idx][gGate], GateInfo[idx][gCX], GateInfo[idx][gCY], GateInfo[idx][gCZ], GateInfo[idx][gSpeed], GateInfo[idx][gCRX], GateInfo[idx][gCRY], GateInfo[idx][gCRZ]);
done=1;
break;
}
}
else
{
if(!GateInfo[idx][gStatus])
{
GateInfo[idx][gStatus] = 1;
MoveDynamicObject(GateInfo[idx][gGate], GateInfo[idx][gOX], GateInfo[idx][gOY], GateInfo[idx][gOZ], GateInfo[idx][gSpeed], GateInfo[idx][gORX], GateInfo[idx][gORY], GateInfo[idx][gORZ]);
done=1;
break;
}
else
{
GateInfo[idx][gStatus] = 0;
MoveDynamicObject(GateInfo[idx][gGate], GateInfo[idx][gCX], GateInfo[idx][gCY], GateInfo[idx][gCZ], GateInfo[idx][gSpeed], GateInfo[idx][gCRX], GateInfo[idx][gCRY], GateInfo[idx][gCRZ]);
done=1;
break;
}
}
}
}
}
if(!done) SendClientMessage(playerid, red,"ERROR: You are not close to a gate");
return 1;
}
plzz help me fixing it