Command Problem[ss]
#1

Hey i have created a command but i dont know why it wont work
i dont get errors/warns or something like this but when i login on game
i press the command that i have done and it shows me something not real
in my server its only me online but it shows me like there are 7players in
please help me out if you know this problem or know how to fix it
Ignore the faction members online the problem its that message shows me 7/45Thanks



Quote:

COMMAND:factions(playerid, params[])
{
new string[90];
for(new i=0;i<MAX_PLAYERS;i++)
if(PlayerInfo[i][playerteam] == COPS || PlayerInfo[i][playerteam] == FBI)
format(string, sizeof(string), "Los Santos Police Department:Members [%d/45]", COPS);
SendClientMessage(playerid, -1, string);

return 1;

}

Reply
#2

help ?!!!
Reply
#3

pawn Код:
COMMAND:factions(playerid, params[])
{
new string[90],count=0;
for(new i=0;i<MAX_PLAYERS;i++)
{
    if(PlayerInfo[i][playerteam] == COPS || PlayerInfo[i][playerteam] == FBI) count++;
}
format(string, sizeof(string), "Los Santos Police Department:Members [%d/45]", count);
SendClientMessage(playerid, -1, string);
return 1;
}
Reply
#4

Well thanks it works now but it shows me only the members that are online..... can you give me an example for all members that are on cops/fbi team ?
Reply
#5

Well, for that i need to see the codes from your saving system (mysql or ini) which is related to their faction
Reply
#6

Here ?
Quote:

if(!fexist("LSPD.ini"))
{
dini_Create("LSPD.ini");
for(new i = 0; i < 150; i++)
{
format(FormatForFaction, sizeof(FormatForFaction), "Member%d", i);
dini_Set("LSPD.ini", FormatForFaction, "None");
}

Reply
#7

It would be useful if you could provide the codes which saves the player's faction.

Or show your setfaction or whatever you call the command that you use to set player's faction
Reply
#8

HEre its the command that i invite members to a faction

Quote:

COMMAND:invite(playerid, params[])
{
if(PlayerInfo[playerid][ranklvl] == 2 && PlayerInfo[playerid][authority_invite] != 1) return SendClientError(playerid, CANT_USE_CMD);
if(PlayerInfo[playerid][ranklvl] > 2) return SendClientError(playerid, CANT_USE_CMD);
if(PlayerInfo[playerid][playerteam] == CIV) return SendClientError(playerid, CANT_USE_CMD);
new iPlayer;
if( sscanf ( params, "u", iPlayer)) return SCP(playerid, "[PlayerID/PartOfName]");
if(!IsPlayerConnected(iPlayer) || iPlayer == playerid) return SendClientError(playerid, PLAYER_NOT_FOUND);
if(GetPlayerFaction(iPlayer) != CIV) return SendClientError(playerid, "Player is not a civilian!");
if(PlayerInfo[iPlayer][playerlvl] < 1 && PlayerInfo[playerid][playerteam] != COPS)
return SendClientError(playerid, "The player is level 1.");
SetPVarInt(iPlayer, "InvitedToFaction", PlayerInfo[playerid][playerteam]);
SetPVarInt(iPlayer, "InvitedBy", playerid);
format(iStr, sizeof(iStr), "%s has invited you to join %s. Use ~r~/accept faction~w~ to join %s.", RPName(playerid), PlayerInfo[playerid][PTeamName],PlayerInfo[playerid][PTeamName]);
ShowInfoBox(iPlayer, "Faction Invite", iStr);
return 1;
}

Reply
#9

Quote:
Originally Posted by Diti1
Посмотреть сообщение
HEre its the command that i invite members to a faction
Show us the command in which the player accepts the invite. I'm thinking what you need to do here is define how many factions there are at the top of the script, and use

pawn Код:
for(new i=0;i>=MAX_FACTIONS;i++)
to loop through the files, sending the players name to the player using SendClientMessage.

I'll write the code for you, I just need to see how you save the factions.
Reply
#10

Here is that
im using an old gm

Quote:

stock Invite(giveplayerid,team)
{
new teampos = GetTeam(team), who = GetPVarInt(giveplayerid, "InvitedBy");
if(who != -1)
{
format(iStr, sizeof(iStr), "# [%s] %s has been invited to the faction by %s", teams[teampos][teamname], RPName(giveplayerid), RPName(who));
SendClientMessageToTeam(team, iStr, COLOR_PLAYER_VLIGHTBLUE);
SetPVarInt(giveplayerid, "InvitedBy", -1);
}
else
{
format(iStr, sizeof(iStr), "# [%s] %s has been invited to the faction", teams[teampos][teamname], RPName(giveplayerid));
SendClientMessageToTeam(team, iStr, COLOR_PLAYER_VLIGHTBLUE);
}
format(iStr, sizeof(iStr),"10[INVITE] %s has been invited to %s.", PlayerName(giveplayerid),teams[teampos][teamname]);
iEcho(iStr);
PlayerInfo[giveplayerid][fpay] = 0;
PlayerTemp[giveplayerid][spawnrdy]=0;
PlayerInfo[giveplayerid][playerteam]=team;
myStrcpy(PlayerInfo[giveplayerid][PTeamName],teams[teampos][teamname]);
SetPlayerTeamEx(giveplayerid,team);
SetPlayerTeam(giveplayerid,team);
PlayerInfo[giveplayerid][ranklvl] = 3; // LOWEST !!!!!!
format(iStr, sizeof(iStr), "Team-%s.txt", PlayerInfo[giveplayerid][PTeamName]);
myStrcpy(PlayerInfo[giveplayerid][rankname], dini_Get(iStr, "startrank"));
PlayerInfo[giveplayerid][fpay] = dini_Int(iStr, "startpayment");
SetPVarInt(giveplayerid, "InvitedToFaction",0);
return 1;
}

and here its accept command Ignore ticket

Quote:

COMMAND:accept(playerid, params[])
{
if(!strlen(params)) return SCP(playerid, "ticket/faction/team");
if(!strcmp(params, "ticket", true))
{
if(!ticket[playerid]) return SendClientError(playerid, "You didn't receive any ticket!");
GivePlayerMoneyEx(playerid,-ticket[playerid]);
format(iStr,sizeof(iStr),"** [PD CENTRAL] %s has paid the ticket of $%d.",PlayerName(playerid),ticket[playerid]);
SendClientMessageToTeam(COPS,iStr,COLOR_PINK);
SendClientMessageToTeam(FBI,iStr,COLOR_PINK);
SendClientMessageToTeam(SASF,iStr,COLOR_PINK);
SendClientMessageToTeam(EMS,iStr,COLOR_PINK);
dini_IntSet(globalstats,"PoliceBank",dini_Int(glob alstats,"PoliceBank")+ticket[playerid]);
ticket[playerid]=0;
return 1;
}
if(!strcmp(params, "faction", true))
{
if(GetPVarInt(playerid, "InvitedToFaction"))
{
Invite(playerid, GetPVarInt(playerid, "InvitedToFaction"));
SetPVarInt(playerid, "InvitedToFaction", 0);
}
return 1;
}
if(!strcmp(params, "team", true))
{
new path[256];
format(path,sizeof(path),"teams/Team-%s.txt",PlayerInfo[playerid][playerteaminvite]);
if(dini_Exists(path))
{
if(PlayerInfo[playerid][playerteam]==CIV)
{
new iPlayer;
SendClientInfoEx(playerid,"You have joined %s.",PlayerInfo[playerid][playerteaminvite]);
PlayerInfo[playerid][teamtier]=2;
myStrcpy(PlayerInfo[playerid][playerteamname],PlayerInfo[playerid][playerteaminvite]);
dUserSet(PlayerName(playerid)).("playerteamname",P layerInfo[playerid][playerteaminvite]);
myStrcpy(PlayerInfo[playerid][playerteaminvite],"None");
PlayerInfo[iPlayer][playerteamname] = PlayerInfo[playerid][playerteamname];
}
}

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)