SA-MP Forums Archive
Command not working. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Command not working. (/showthread.php?tid=394829)



Command not working. - Laure - 24.11.2012

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;
}



Re: Command not working. - Glad2BeHere - 24.11.2012

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


Re: Command not working. - Laure - 24.11.2012

Sorry but i didnt get you.


Re: Command not working. - Faisal_khan - 24.11.2012

Remove idx from your code.


Respuesta: Command not working. - Parka - 24.11.2012

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;




Re: Command not working. - Laure - 24.11.2012

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



Re: Command not working. - Laure - 24.11.2012

Didnt help me at all.


Re: Command not working. - Glad2BeHere - 24.11.2012

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


Re: Command not working. - Laure - 24.11.2012

I did as you stated as well didnt work.


Re: Command not working. - Glad2BeHere - 24.11.2012

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