[pwn]
public GangCreate(leaderid,gangname[],gangcolour)
{
if (!IsPlayerRegistered(leaderid)) return 0; new tempname[MAX_STRING];
set(tempname,gangname);
if (!StringCharCheck(tempname))
{
SendPlayerFormattedText(leaderid, lang_texts[6][72] , 0,COLOUR_RED);
return 0;
}
// udb
new udbfilename[MAX_NAME];
set(udbfilename,gangname);
strcat(udbfilename,".Gang",sizeof(udbfilename));
// dini
new dinifilename[MAX_STRING];
format(dinifilename,sizeof(dinifilename),"%sGTO.Gang.%s.txt",GangDB,gangname);
if ((udb_Exists(udbfilename)) || (dini_Exists(dinifilename)))
{
SendClientMessage(leaderid,COLOUR_RED, lang_texts[6][73] );
return 0;
}
// Create the gang
new gangid;
for (new id=1;id<MAX_GANGS;id++)
{
if(!Gangs[id][gang_active])
{
gangid = id;
Gangs[id][gang_active] = true; // find first free gang slot and andd our gang
break;
}
}
set(Gangs[gangid][gang_name],gangname);
Gangs[gangid][gang_colour] = gangcolour;
Gangs[gangid][gang_kills] = 0;
Gangs[gangid][gang_score] = 0;
for (new gangmember = 0;gangmember<MAX_GANG_SIZE;gangmember++)
{ // foreach member
GangMembers[gangid][gangmember] = GetFreeMemberID();
new memberid = GangMembers[gangid][gangmember];
if (memberid == 0)
{
WriteLog("script error: free gang member id not found.");
return 0;
}
GangMemberInfo[memberid][member_active] = 1;
GangMemberInfo[memberid][member_online] = 0;
GangMemberInfo[memberid][member_playerid] = INVALID_PLAYER_ID;
}
new memberid = GangMembers[gangid][0];
set(GangMemberInfo[memberid][member_name],oGetPlayerName(leaderid));
GangMemberInfo[memberid][member_playerid] = leaderid;
GangMemberInfo[memberid][member_online] = 1;
set(PlayerGangName[leaderid],gangname);
PlayerGangid[leaderid] = gangid;
GangSave(gangid);
return gangid;
}
[/pwn]
тут надо в этом цикле:
[pwn]
for (new gangmember = 0;gangmember<MAX_GANG_SIZE;gangmember++)
{ // foreach member
GangMembers[gangid][gangmember] = GetFreeMemberID();
new memberid = GangMembers[gangid][gangmember];
if (memberid == 0)
{
WriteLog("script error: free gang member id not found.");
return 0;
}
GangMemberInfo[memberid][member_active] = 1;
GangMemberInfo[memberid][member_online] = 0;
GangMemberInfo[memberid][member_playerid] = INVALID_PLAYER_ID;
}
[/pwn]
сделать обнуление переменной ника члена банды,т.е. так:
[pwn]
for (new gangmember = 0;gangmember<MAX_GANG_SIZE;gangmember++)
{ // foreach member
GangMembers[gangid][gangmember] = GetFreeMemberID();
new memberid = GangMembers[gangid][gangmember];
if (memberid == 0)
{
WriteLog("script error: free gang member id not found.");
return 0;
}
GangMemberInfo[memberid][member_active] = 1;
GangMemberInfo[memberid][member_online] = 0;
GangMemberInfo[memberid][member_playerid] = INVALID_PLAYER_ID;
set(GangMemberInfo[memberid][member_name],nullstr);
}
[/pwn]