Help - small problem? -
NewYorkRP - 29.11.2010
Код:
if(strcmp(cmd,"/entranceedit",true)==0)
{
if(PlayerInfo[playerid][pAdmin] < 1337)
{
SendClientMessage(playerid, COLOR_GREY, " You are not authorized to use this command.");
return 1;
}
new string[128];
new id = strvalEx(tmp);
format(string, sizeof(string), "Entrances/Entrance_%d.ini", id);
if(!fexist(string))
{
SendClientMessage(playerid, COLOR_GREY, "Invalid entrance ID!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /entranceedit [entrance id] [usage]");
SendClientMessage(playerid, COLOR_GREY, "USAGE: Interior, Exterior or Factiontype.");
return 1;
}
When i try
/entranceedit 1 Exterior
It always pops up 'Invalid entrance ID'.
BUT: I do have Entrances/Entrance_1.ini
Can someone help? Why doesnt it work?
The command works, and has no errors, but the custom error message pops up, saying 'Invalid entrance ID'.
How can i fix this?
Re: Help - small problem? -
NewYorkRP - 29.11.2010
bump please.
Re: Help - small problem? -
Ash. - 29.11.2010
Can you indent your code properly, its hard to read as it is now.
Re: Help - small problem? -
NewYorkRP - 29.11.2010
Done.
This forum requires that you wait 120 seconds between posts. Please try again in 46 seconds.
Re: Help - small problem? -
Ash. - 29.11.2010
Im not sure, but try changing %d to %i - i was always under the impression that %d is used for decimals such as floats.
Re: Help - small problem? -
NewYorkRP - 29.11.2010
Still doesnt work :/.
Re: Help - small problem? -
NewYorkRP - 29.11.2010
bump...............
Re: Help - small problem? -
MadeMan - 29.11.2010
Wrong order
pawn Код:
if(strcmp(cmd,"/entranceedit",true)==0)
{
if(PlayerInfo[playerid][pAdmin] < 1337)
{
SendClientMessage(playerid, COLOR_GREY, " You are not authorized to use this command.");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /entranceedit [entrance id] [usage]");
SendClientMessage(playerid, COLOR_GREY, "USAGE: Interior, Exterior or Factiontype.");
return 1;
}
new string[128];
new id = strvalEx(tmp);
format(string, sizeof(string), "Entrances/Entrance_%d.ini", id);
if(!fexist(string))
{
SendClientMessage(playerid, COLOR_GREY, "Invalid entrance ID!");
return 1;
}
Re: Help - small problem? -
NewYorkRP - 29.11.2010
Thanks MadeMan, but now i have another problem
pawn Код:
if(strcmp(cmd,"/entranceedit",true)==0)
{
if(PlayerInfo[playerid][pAdmin] < 1337)
{
SendClientMessage(playerid, COLOR_GREY, " You are not authorized to use this command.");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /entranceedit [entrance id] [usage]");
SendClientMessage(playerid, COLOR_GREY, "USAGE: Interior, Exterior or Factiontype.");
return 1;
}
new string2[128];
new id = strvalEx(tmp);
format(string2, sizeof(string2), "Entrances/Entrance_%d.ini", id);
if(!fexist(string2))
{
SendClientMessage(playerid, COLOR_GREY, "Invalid entrance ID!");
return 1;
}
{
if(PlayerInfo[playerid][pAdmin] >= 1337)
{
if(strcmp(tmp, "test", true) == 0)
{
new lolstring[128];
DestroyPickup(Entrances[id][tPickupID]);
PlayerInfo[playerid][bExtID] = GetPlayerInterior(playerid);
GetPlayerPos(playerid, PlayerInfo[playerid][bExtX], PlayerInfo[playerid][bExtY], PlayerInfo[playerid][bExtZ]);
format(lolstring, sizeof(lolstring), "Entrance changed! (X: %f, Y: %f, Z: %f).", PlayerInfo[playerid][bExtX], PlayerInfo[playerid][bExtY], PlayerInfo[playerid][bExtZ]);
SendClientMessage(playerid, COLOR_YELLOW, lolstring);
Entrances[id][tEntranceX] = PlayerInfo[playerid][bExtX];
Entrances[id][tEntranceY] = PlayerInfo[playerid][bExtY];
Entrances[id][tEntranceZ] = PlayerInfo[playerid][bExtZ];
Entrances[id][tEntranceInt] = PlayerInfo[playerid][bExtID];
Entrances[id][tPickupID] = CreatePickup(1239, 23, Entrances[id][tEntranceX], Entrances[id][tEntranceY], Entrances[id][tEntranceZ]);
SaveEntrance(id);
}
}
}
return 1;
}
that is my code, it compiles fine, but just 1 warning about loose indentation.
When i type /entranceedit 1 test
nothing happens?
I AM 1338 ADMIN
Re: Help - small problem? -
MadeMan - 29.11.2010
pawn Код:
if(!fexist(string2))
{
SendClientMessage(playerid, COLOR_GREY, "Invalid entrance ID!");
return 1;
}
tmp = strtok(cmdtext, idx); // add this line
if(PlayerInfo[playerid][pAdmin] >= 1337)
{