Command not working.
#1

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;
}
Reply
#2

cause u didnt define ids what is idx so in the code idx is defined all as the same thing
Reply
#3

Sorry but i didnt get you.
Reply
#4

Remove idx from your code.
Reply
#5

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

or

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

Reply
#6

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")
Reply
#7

Didnt help me at all.
Reply
#8

pawn Код:
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
Reply
#9

I did as you stated as well didnt work.
Reply
#10

looks for the faction enum and tell me what is the new

u will see
pawn Код:
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

pawn Код:
enum fac
{

}
new Facinfo[w/e][fac]
for eg im waiting
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)