PDA

View Full Version : sscanf unkown command


melik53
09/07/2016, 05:56 AM
sscanf unkown command


CMD:kapi(playerid, params[])
{
if(!IsPlayerAdmin(playerid)) return 0;
new sifre[MAX_SIFRE];
if(sscanf(params, "s["#MAX_SIFRE"]", sifre)) return SendClientMessage(playerid, 0xFFFFFFFF, "Kullanım: /kapi [şifre]");
new id = -1;

for(new i; i < MAX_GATE; ++i)
{
if(GateData[i][Aktif] == 0) continue;

if(IsPlayerInRangeOfPoint(playerid, 10.0, GateData[i][posX], GateData[i][posY], GateData[i][posZ]))
{
id = i;
break;
}
}

if(id == -1) return SendClientMessage(playerid, 0xFFFFFFFF, "Yakınınızda bir kapı yok.");
if(strcmp(GateData[id][Sifre], sifre, false, MAX_SIFRE)) return SendClientMessage(playerid, 0xFFFFFFFF, "Kapı şifresi yanlış.");
switch(GateData[id][Durum])
{
case GATE_DURUM_KAPALI:
{
GateData[id][Durum] = GATE_DURUM_ACIK;
MoveObject(GateData[id][Obje], GateData[id][posX], GateData[id][posY], GateData[id][posZ]-8, 3.0, GateData[id][rotX], GateData[id][rotY], GateData[id][rotZ]);
}

case GATE_DURUM_ACIK:
{
GateData[id][Durum] = GATE_DURUM_KAPALI;
MoveObject(GateData[id][Obje], GateData[id][posX], GateData[id][posY], GateData[id][posZ], 3.0, GateData[id][rotX], GateData[id][rotY], GateData[id][rotZ]);
}
}

return 1;
}

CMD:gateolustur(playerid, params[])
{
if(!IsPlayerAdmin(playerid)) return 0;
new model, sifre[MAX_SIFRE];
if(sscanf(params, "is["#MAX_SIFRE"]", model, sifre)) return SendClientMessage(playerid, 0xFFFFFFFF, "Kullanım: /gateolustur [model id] [şifre]");
GateOlustur(playerid, model, sifre);

return 1;
}

CMD:gatebilgi(playerid, params[])
{
if(!IsPlayerAdmin(playerid)) return 0;
new id = -1;

for(new i; i < MAX_GATE; ++i)
{
if(GateData[i][Aktif] == 0) continue;

if(IsPlayerInRangeOfPoint(playerid, 10.0, GateData[i][posX], GateData[i][posY], GateData[i][posZ]))
{
id = i;
break;
}
}

if(id == -1) return SendClientMessage(playerid, 0xFFFFFFFF, "Yakınınızda bir gate yok.");

new string[64];
format(string, sizeof(string), "Gate ID: %d", id);
SendClientMessage(playerid, 0xFFFFFFFF, string);
format(string, sizeof(string), "Gate Şifresi: %s", GateData[id][Sifre]);
SendClientMessage(playerid, 0xFFFFFFFF, string);

return 1;
}

CMD:gateduzenle(playerid, params[])
{
if(!IsPlayerAdmin(playerid)) return 0;
new id;
if(sscanf(params, "i", id)) return SendClientMessage(playerid, 0xFFFFFFFF, "Kullanım: /gatesil [gate id]");
if(GateData[id][Aktif] == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "Geçerli bir Gate ID girmediniz.");
GateID[playerid] = id;
EditObject(playerid, GateData[id][Obje]);

return 1;
}

CMD:gatesil(playerid, params[])
{
if(!IsPlayerAdmin(playerid)) return 0;
new id;
if(sscanf(params, "i", id)) return SendClientMessage(playerid, 0xFFFFFFFF, "Kullanım: /gatesil [gate id]");
if(GateData[id][Aktif] == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "Geçerli bir Gate ID girmediniz.");
GateTemizle(id);

return 1;
}

Napst34
09/07/2016, 05:58 AM
The problem is?

melik53
09/07/2016, 06:10 AM
sscanf giving so bad unkown command

Napst34
09/07/2016, 06:16 AM
if(!IsPlayerAdmin(playerid)) return 0;

Make it like this
if(!IsPlayerAdmin(playerid)) return SendClientMessage(....);

melik53
09/07/2016, 06:51 AM
I tried and did not

SyS
09/07/2016, 09:06 AM
every code has that problem? you might check the first cmd again