Help with TURFS
#1

Hello and sorry for my english. My problem is: When i start turf and when i win the turf with this command (/turfs) i check which gang how many turfs have. When i win turf and i check i have one (this is okay) but when someone else (leader to other gang) attack my turf and when he win my turf in /turfs i have again 1 turf i need to have 0 .. And i want to ask how to make /turfs in dialog and i want to show me all gangs in one dialog like a
Grove Street Families - 0
Rolling Heights Ballas - 2
Los Santos Vagos - 0
Quote:

if(strcmp(x_job,"1",true) == 0)
{
SendClientMessage(playerid, COLOR_WHITE, "--- Grove Turfs ---");
format(string, sizeof(string), "Turfs - %d",TeamInfo[TEAM_GROVE][TurfWarsWon]);
SendClientMessage(playerid, COLOR_LIGHTBLUE,string);
}
//
if(strcmp(x_job,"2",true) == 0)
{
SendClientMessage(playerid, COLOR_WHITE, "--- Ballas Turfs ---");
format(string, sizeof(string), "Turfs - %d",TeamInfo[TEAM_BALLAS][TurfWarsWon]);
SendClientMessage(playerid, COLOR_LIGHTBLUE,string);
}
//
if(strcmp(x_job,"3",true) == 0)
{
SendClientMessage(playerid, COLOR_WHITE, "--- Vagos Turfs ---");
format(string, sizeof(string), "Turfs - %d",TeamInfo[TEAM_VAGOS][TurfWarsWon]);
SendClientMessage(playerid, COLOR_LIGHTBLUE,string);
}
//

This is my command and sorry again for my english and thanks for help
Reply
#2

1. what exactly is "x_job"
2. Why do you put a number into a string
3. why not use switch instead of if (you didn't even use if else, but just multiple if statements), since x_job can only be one of the options
4. format your goddamn code


And in advance, sorry that this doesn't fix your problem, thought i should still mention.
Would like to help you with your problem, but i am not even sure what you mean Are you talking about the variable 'TurfWarsWon' being wrong, because of yes, that would be a misleading variable name i think, because if even if you win one and loose one, you still won one.
So, might you explain a little further or give more code (or both, lol)
Reply
#3

Quote:

if(strcmp(cmd, "/turfs", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new para1;
new x_job[256];
x_job = strtok(cmdtext, idx);
tmp = strtok(cmdtext, idx);
if(!strlen(x_job)) {
SendClientMessage(playerid, COLOR_RED, "Use Grove - 1,Ballas - 2 и тн.");
SendClientMessage(playerid, COLOR_RED, "Grove, Ballas, Vagos, Straight Outta Compton, 21, VCripz, Aztec");
SendClientMessage(playerid, COLOR_RED, "ThugLife, MS13,DPK");
SendClientMessage(playerid, COLOR_RED, "Black Mafia, Boyz, Boys");
return 1;
}
//
//

if(strcmp(x_job,"1",true) == 0)
{
SendClientMessage(playerid, COLOR_WHITE, "--- Grove Turfs ---");
format(string, sizeof(string), "Turfs - %d",TeamInfo[TEAM_GROVE][TurfWarsWon]);
SendClientMessage(playerid, COLOR_LIGHTBLUE,string);
}
//
if(strcmp(x_job,"2",true) == 0)
{
SendClientMessage(playerid, COLOR_WHITE, "--- Ballas Turfs ---");
format(string, sizeof(string), "Turfs - %d",TeamInfo[TEAM_BALLAS][TurfWarsWon]);
SendClientMessage(playerid, COLOR_LIGHTBLUE,string);
}
//
if(strcmp(x_job,"3",true) == 0)
{
SendClientMessage(playerid, COLOR_WHITE, "--- Vagos Turfs ---");
format(string, sizeof(string), "Turfs - %d",TeamInfo[TEAM_VAGOS][TurfWarsWon]);
SendClientMessage(playerid, COLOR_LIGHTBLUE,string);
}
//

I want to make this in dialog with all gangs like a: When i use this command /turfs to show me in dialog
Grove Street Families - 0 Turfs
Rolling Heights Ballas - 0 turfs
Los Santos Vagos - 0 Turfs
i try to make this but i can't. If you can to show me the code or something thank you
Reply
#4

Just put everything into one string and display it??

PHP код:
new turfString[80];
format(turfStringsizeof(turfString), "Groove Turfs - %d\nBallas Turfs - %d\nVagos Turfs - %d",TeamInfo[TEAM_GROVE][TurfWarsWon], TeamInfo[TEAM_BALLAS][TurfWarsWon], TeamInfo[TEAM_VAGOS][TurfWarsWon]);
ShowPlayerDialog(playeridREPLACE_ME_WITH_AN_NUMBER_OR_AN_NUMERIC_DEFINITIONDIALOG_STYLER_MSGBOX"Number of turfs owned"turfString"Ok"""); 
\n inserts a line break
Reply
#5

Yup thank you that shoud be good but, now when i have 1 turf and other gang attack me and won my turf in /turfs again i have 1 turf with one word /turfs cant updating
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)