Clanconfig.txt - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Clanconfig.txt (
/showthread.php?tid=223274)
Clanconfig.txt -
SonToku - 09.02.2011
okay i've clanwar gamemode that detect clantag(names) from ClanConfig.txt in script files
is there anyway to change the team names by in game command?
Re: Clanconfig.txt -
On_Top_Non_Stop - 09.02.2011
EDIT: That sounded cheeky.
Rephrased: Please post the code you need help with.
Re: Clanconfig.txt -
SonToku - 09.02.2011
okay this is it
Код:
rConfig()
{
new File:fhandle;
new cname[256];
new temp[256];
new value[256];
fhandle = fopen("ClanConfig.txt",io_readwrite);
while(fread(fhandle,temp,sizeof(temp),false))
{
cname = strtok(temp,0);
value = strtok(temp,(strlen(cname)+1));
if(strcmp(cname,"Team-1",true) == 0) strins(TEAM1,value,0,MAX_STRING);
else if(strcmp(cname,"Team-2",true) == 0) strins(TEAM2,value,0,MAX_STRING);
else if(strcmp(cname,"Max-Clan-Kills",true) == 0) MAXKILLS = strval(value);
else if(strcmp(cname,"Max-Rounds",true) == 0) MaxRounds = strval(value);
else if(strcmp(cname,"Weapon1",true) == 0) wpn1 = strval(value);
else if(strcmp(cname,"Weapon2",true) == 0) wpn2 = strval(value);
else if(strcmp(cname,"Weapon3",true) == 0) wpn3 = strval(value);
else if(strcmp(cname,"Ammo1",true) == 0) ammo1 = strval(value);
else if(strcmp(cname,"Ammo2",true) == 0) ammo2 = strval(value);
else if(strcmp(cname,"Ammo3",true) == 0) ammo3 = strval(value);
}
fclose(fhandle);
return 1;
}
scriptfiles/ClanConfig.txt
Team-1 D$K1
Team-2 D$K2
Max-Clan-Kills 3
Max-Rounds 3
Weapon1 26
Weapon2 28
Weapon3 0
Ammo1 99999
Ammo2 99999
Ammo3 0
this is what we need i think
if need anything else tell me i'll post it too and yeah im new here in these forums ;P
Re: Clanconfig.txt -
SonToku - 09.02.2011
any help?
Re: Clanconfig.txt -
Cameltoe - 09.02.2011
In what variable do you store the team name?
Re: Clanconfig.txt -
SonToku - 09.02.2011
yes it detect the name of TEAM1 and TEAM2 from .txt file
and i want to change the team names directly in game?
for example
TEAM1 D$K
TEAM2 D$K2
so how to change "D$K" & "D$K2" in game, will be very appreciated
Re: Clanconfig.txt -
Cameltoe - 09.02.2011
Then i would do like this:
pawn Код:
stock ChangeClanName(Clan[], nName[])
{
strmid(Clan, nName, 0, sizeof( nName +1 ), sizeof( nName +1 ));
}
Re: Clanconfig.txt -
SonToku - 09.02.2011
then hows gonna be the command? sry im little bit noob @scripting and thanks very much mate
Re: Clanconfig.txt -
SonToku - 09.02.2011
help...
Re: Clanconfig.txt -
Cameltoe - 09.02.2011
pawn Код:
command(cname, playerid, params[])
{
new cTeam, cName[50];
if(sscanf(params, "is[50]", cTeam, cName)) return SendClientMessage(playerid, COLOR_RED, "Usage: /cname [ Team ( 1 - 2 ) - Name");
if(cTeam == 1 ) ChangeClanName(TEAM1, cName);
else if(cTeam == 2 ) ChangeClanName(TEAM2, cName);
else return SendClientMessage(playerid, COLOR_RED, "Error: Invalid team.");
}
Not sure if it works though :PP