String doesnt show up in ClientMessage. -
Ballu Miaa - 26.08.2012
Hello Everyone,
I was creating a faction system for myself. Everything stores fine and loads perfectly. I was creating a command to set someone the leader of a faction. So i made the code below. It works fine InGame , but the only problem is 'I want it to display the name of the faction too but it skips the faction name part. It is null. Nothing shows up in ClientMessage'.
The command just works fine only problem is the name of the faction does not show up.
pawn Код:
COMMAND:afaction(playerid, params[])
{
new cmd[58];
if (sscanf(params, "s ", cmd) != 0)
{
return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /afaction setleader");
}
if (strcmp("setleader", cmd, true, 10) == 0)
{
new factionid,player,string[95];
if (!sscanf(params, "sud", cmd, player,factionid))
{
if(player == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_WHITE, "ERROR: That player is not connected.");
if(FactionExists(factionid))
{
Character[player][cFactionID] = factionid;
Character[player][cFactionRank] = 5;
format(string,sizeof(string),"You have been made the leader of the Faction: %s by an Admin.",Factions[factionid][fName]);
SendClientMessage(player,COLOR_GREEN,string);
}
else return SendClientMessage(playerid, COLOR_WHITE, "ERROR: That faction does not exist. Please check again");
}
else return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /afaction setleader <playerid)> <factionid>");
}
return 1;
}
Why exactly i dont see the name of the faction? The ID is fine and everything else. I save and load things using SQLite. Help will be appreciated a lot.
Thanks
Re: String doesnt show up in ClientMessage. -
Akira297 - 26.08.2012
I'm not trying to sound mean, since I know you're good I will point you to this direction.
Your error remains between these two lines.
Код:
new factionid,player,string[95];
if (!sscanf(params, "sud", cmd, player,factionid))
Re: String doesnt show up in ClientMessage. -
Ballu Miaa - 26.08.2012
Quote:
Originally Posted by Akira297
I'm not trying to sound mean, since I know you're good I will point you to this direction.
Your error remains between these two lines.
Код:
new factionid,player,string[95];
if (!sscanf(params, "sud", cmd, player,factionid))
|
But Kira it works fine. The parameters works fine too. It set's the correct playerid the leader of faction id provided.
If Faction ID is not valid then returns the error also. Faction ID and Rank saves fine too. But Client Message doesnt show the name of the faction? Damn thats weird.
Re: String doesnt show up in ClientMessage. -
Akira297 - 26.08.2012
Код:
format(string,sizeof(string),"You have been made the leader of the Faction: %s by an Admin.",Factions[factionid][fName]);
-.-
Re: String doesnt show up in ClientMessage. -
Ballu Miaa - 26.08.2012
Quote:
Originally Posted by Akira297
Код:
format(string,sizeof(string),"You have been made the leader of the Faction: %s by an Admin.",Factions[factionid][fName]);
-.-
|
EDIT: Got the problem in the end. The SQLID of the faction is 1 but the InGame Vaue of the Array is 0.
The there are two ID's of every faction which are SQLID: 1 and IG-ID: 0.
It works fine when i use FactionExistsEx function and use 0 as the faction ID. Shows me the name of the faction
Re: String doesnt show up in ClientMessage. -
Akira297 - 26.08.2012
Look at the ending variables.
Re: String doesnt show up in ClientMessage. -
Ballu Miaa - 26.08.2012
Quote:
Originally Posted by Akira297
Look at the ending variables.
|
Solved Thanks to Kira mah babe for her replies.

Rep+6 Added
Re: String doesnt show up in ClientMessage. -
Akira297 - 26.08.2012
Quote:
Originally Posted by Ballu Miaa
Solved Thanks to Kira mah babe for her replies.  Rep+6 Added
|
Told you, didn't need any help and you were good
♥
Re: String doesnt show up in ClientMessage. -
SuperViper - 26.08.2012
Try
factionid - 1.
EDIT: Too late.
Re: String doesnt show up in ClientMessage. -
leonardo1434 - 26.08.2012
i just saw this now, it seems solved, but i see no point at using sscanf twice.