PDA

View Full Version : Command not working.


Laure
24/11/2012, 07:16 AM
Whats wrong here it just shows is Federal Bureau of Investigation faction and dont show Leader name and members too
please help me out
CMD:factions(playerid, params[])
{
new string[128], idx;
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
{
format(string, sizeof(string), "Los Santos Police Department | Leader: %s | Members: %d",FacInfo[idx][FacLeader], FacInfo[idx][facMembers]);
format(string, sizeof(string), "San Andreas Government | Leader: %s | Members: %d", FacInfo[idx][FacLeader], FacInfo[idx][facMembers]);
format(string, sizeof(string), "The Hitman Agency | Leader: %s | Members: %d", FacInfo[idx][FacLeader], FacInfo[idx][facMembers]);
format(string, sizeof(string), "San Andreas News | Leader: %s | Members: %d", FacInfo[idx][FacLeader], FacInfo[idx][facMembers]);
format(string, sizeof(string), "Los Santos Fire and Medic Department | Leader: %s | Members: %d", FacInfo[idx][FacLeader], FacInfo[idx][facMembers]);
format(string, sizeof(string), "Federal Bureau of Investigation | Leader: %s | Members: %d", FacInfo[idx][FacLeader], FacInfo[idx][facMembers]);
SendClientMessage(playerid, COLOR_WHITE, string);
}
return 1;
}

Glad2BeHere
24/11/2012, 07:23 AM
cause u didnt define ids what is idx so in the code idx is defined all as the same thing

Laure
24/11/2012, 07:25 AM
Sorry but i didnt get you.

Faisal_khan
24/11/2012, 07:30 AM
Remove idx from your code.

Parka
24/11/2012, 07:45 AM
CMD:factions(playerid, params[])
{
new string[128], idx;
while (idx < sizeof(FacInfo))
{
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
{
format(string, sizeof(string), "Los Santos Police Department | Leader: %s | Members: %d",FacInfo[idx][FacLeader], FacInfo[idx][facMembers]);
format(string, sizeof(string), "San Andreas Government | Leader: %s | Members: %d", FacInfo[idx][FacLeader], FacInfo[idx][facMembers]);
format(string, sizeof(string), "The Hitman Agency | Leader: %s | Members: %d", FacInfo[idx][FacLeader], FacInfo[idx][facMembers]);
format(string, sizeof(string), "San Andreas News | Leader: %s | Members: %d", FacInfo[idx][FacLeader], FacInfo[idx][facMembers]);
format(string, sizeof(string), "Los Santos Fire and Medic Department | Leader: %s | Members: %d", FacInfo[idx][FacLeader], FacInfo[idx][facMembers]);
format(string, sizeof(string), "Federal Bureau of Investigation | Leader: %s | Members: %d", FacInfo[idx][FacLeader], FacInfo[idx][facMembers]);
SendClientMessage(playerid, COLOR_WHITE, string);
}
}
return 1;
}


or


CMD:factions(playerid, params[])
{
new string[128];
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
{
format(string, sizeof(string), "Los Santos Police Department | Leader: %s | Members: %d",FacInfo[playerid][FacLeader], FacInfo[playerid][facMembers]);
format(string, sizeof(string), "San Andreas Government | Leader: %s | Members: %d", FacInfo[playerid][FacLeader], FacInfo[playerid][facMembers]);
format(string, sizeof(string), "The Hitman Agency | Leader: %s | Members: %d", FacInfo[playerid][FacLeader], FacInfo[playerid][facMembers]);
format(string, sizeof(string), "San Andreas News | Leader: %s | Members: %d", FacInfo[playerid][FacLeader], FacInfo[playerid][facMembers]);
format(string, sizeof(string), "Los Santos Fire and Medic Department | Leader: %s | Members: %d", FacInfo[playerid][FacLeader], FacInfo[playerid][facMembers]);
format(string, sizeof(string), "Federal Bureau of Investigation | Leader: %s | Members: %d", FacInfo[playerid][FacLeader], FacInfo[playerid][facMembers]);
SendClientMessage(playerid, COLOR_WHITE, string);
}
return 1;
}

Laure
24/11/2012, 07:47 AM
Did it but i couldnt fix this error
D:\Xtreme Gaming Roleplay\gamemodes\xg-rp.pwn(4801) : error 032: array index out of bounds (variable "FacInfo")
D:\Xtreme Gaming Roleplay\gamemodes\xg-rp.pwn(4802) : error 032: array index out of bounds (variable "FacInfo")
D:\Xtreme Gaming Roleplay\gamemodes\xg-rp.pwn(4803) : error 032: array index out of bounds (variable "FacInfo")
D:\Xtreme Gaming Roleplay\gamemodes\xg-rp.pwn(4804) : error 032: array index out of bounds (variable "FacInfo")
D:\Xtreme Gaming Roleplay\gamemodes\xg-rp.pwn(4805) : error 032: array index out of bounds (variable "FacInfo")
D:\Xtreme Gaming Roleplay\gamemodes\xg-rp.pwn(4806) : error 032: array index out of bounds (variable "FacInfo")

Laure
24/11/2012, 08:09 AM
Didnt help me at all.

Glad2BeHere
24/11/2012, 08:13 AM
CMD:factions(playerid, params[])
{
new string[128];
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
for(new idx=1; idx<MAX_FACTIONS idx++)
{
format(string, sizeof(string), "(%d)Leader: %s | Members: %d ", idx, FacInfo[playerid][FacLeader], FacInfo[playerid][facMembers]);
SendClientMessage(playerid, COLOR_WHITE, string);
}
return 1;
}


curious did u attempted this from the zGaming GM :? and is it MAX_FACTIONS in ur GM :? idk what u used to define it so try this code

Laure
24/11/2012, 08:14 AM
I did as you stated as well didnt work.

Glad2BeHere
24/11/2012, 08:24 AM
looks for the faction enum and tell me what is the new

u will see

new FacInfo[something here][w/e enum iz here];


i want the sfirst [] the on write after FacInfo telling me whats the idx ty, idx iz defined as that so can u please post if u dont understand post the entire enum with the new the below it


enum fac
{

}
new Facinfo[w/e][fac]


for eg im waiting

Laure
24/11/2012, 08:32 AM
here
enum facInfo
{
fRank0[32],
fRank1[32],
fRank2[32],
fRank3[32],
fRank4[32],
fRank5[32],
fRank6[32],
fCars[30],
fDiv1[8],
fDiv2[8],
fDiv3[8],
FacLeader,
facMembers,
fDiv4[8]

}
new FacInfo[MAX_FACTIONS][facInfo];

Glad2BeHere
24/11/2012, 08:41 AM
Try this


CMD:factions(playerid, params[])
{
new string[128];
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
for(new idx=1; idx<MAX_FAMILIES; idx++)
{
format(string, sizeof(string), "(%d)Leader: %s | Members: %d ", idx, FacInfo[playerid][FacLeader], FacInfo[playerid][facMembers]);
SendClientMessage(playerid, COLOR_WHITE, string);
}
return 1;
}

Laure
24/11/2012, 09:25 AM
Didnt help too.

Glad2BeHere
24/11/2012, 09:34 AM
y did i do that lmfao sorry!!!!!!!!!!!!!!!!

CMD:factions(playerid, params[])
{
new string[128];
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
for(new idx=1; idx<MAX_FACTIONS; idx++)
{
format(string, sizeof(string), "(%d)Leader: %s | Members: %d ", idx, FacInfo[playerid][FacLeader], FacInfo[playerid][facMembers]);
SendClientMessage(playerid, COLOR_WHITE, string);
}
return 1;


if this doesnt work let me sorry lmfao i forgot to switch some stuff :p cuz i relize u using zGaming did it work :?

Skimmer
24/11/2012, 09:38 AM
Try this here,

CMD:factions(playerid, params[])
{
new string[6][128], idx;
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
format(string[0], sizeof(string[0]), "Los Santos Police Department | Leader: %s | Members: %d",FacInfo[idx][FacLeader], FacInfo[idx][facMembers]);
format(string[1], sizeof(string[1]), "San Andreas Government | Leader: %s | Members: %d", FacInfo[idx][FacLeader], FacInfo[idx][facMembers]);
format(string[2], sizeof(string[2]), "The Hitman Agency | Leader: %s | Members: %d", FacInfo[idx][FacLeader], FacInfo[idx][facMembers]);
format(string[3], sizeof(string[3]), "San Andreas News | Leader: %s | Members: %d", FacInfo[idx][FacLeader], FacInfo[idx][facMembers]);
format(string[4], sizeof(string[4]), "Los Santos Fire and Medic Department | Leader: %s | Members: %d", FacInfo[idx][FacLeader], FacInfo[idx][facMembers]);
format(string[5], sizeof(string[5]), "Federal Bureau of Investigation | Leader: %s | Members: %d", FacInfo[idx][FacLeader], FacInfo[idx][facMembers]);
SendClientMessage(playerid, COLOR_WHITE, string[0]);
SendClientMessage(playerid, COLOR_WHITE, string[1]);
SendClientMessage(playerid, COLOR_WHITE, string[2]);
SendClientMessage(playerid, COLOR_WHITE, string[3]);
SendClientMessage(playerid, COLOR_WHITE, string[4]);
SendClientMessage(playerid, COLOR_WHITE, string[5]);
return 1;
}

Glad2BeHere
24/11/2012, 09:47 AM
mouse breaker y did u do that what iz idx :? u never defined idx, see how u defined string by formatting it u never stated what is idx its just there

Laure
24/11/2012, 10:21 AM
Still it didnt help me at all.

Glad2BeHere
24/11/2012, 10:23 AM
then i know the correct answer to the question and that is because zGaming fractions are not dynamic , there families are though, so it would work like that u have to format for each family watch how he loaded n save them