if(strcmp(cmd, "/setclan", true) == 0)
{
if(AccountInfo[playerid][AdminLevel] >= 4)
{
new clanname, clantag;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, "USAGE: /setclan [clan name] [tag]");
return 1;
}
clanname = strval(tmp);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /setclan [clan name] [tag]");
tmp = strtok(cmdtext, idx);
clantag = strval(tmp);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /setclan [clan name] [tag]");
format(string, sizeof(string), "clans/%s.ini", clanname);
if(dini_Exists(string)) return SendClientMessage(playerid,COLOR_RED, "Clan exists already");
if(!dini_Exists(string))
{
dini_Create(string);
}
dini_Set(string, "clantag", clantag);
format(string, sizeof(string), "Clan %s using clantag %s was successfully created", clanname, clantag);
SendClientMessage(playerid, COLOR_GREEN, string);
SendClientMessage(playerid, COLOR_GREEN, "Use /setclanmember [clan name] [player ID] to add a clanmember");
return 1;
}
else return SendClientMessage(playerid,COLOR_RED, "You're not authorized to use that command");
}
Originally Posted by Redgie
Add some indentation and I'll be more than willing to help, currently it's just a straight block of code
![]() |
Originally Posted by Benne
Hypar how did you fix it because I think I got the same problem with /factionname
|
new clanname[128], clantag[10];
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new clanname[128];
while ((idx < length) && ((idx - offset) < (sizeof(clanname) - 1)))
{
clanname[idx - offset] = cmdtext[idx];
idx++;
}
clanname[idx - offset] = EOS;
if(strcmp(cmd, "/setclan", true) == 0)
{
if(AccountInfo[playerid][AdminLevel] >= 4)
{
new clanname[32], clantag[32];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, "USAGE: /setclan [clan name] [tag]");
return 1;
}
format(clanname, sizeof(clanname), tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /setclan [clan name] [tag]");
format(clantag, sizeof(clantag), tmp);
format(string, sizeof(string), "clans/%s.ini", clanname);
if(dini_Exists(string)) return SendClientMessage(playerid,COLOR_RED, "Clan exists already");
else
{
dini_Create(string);
}
dini_Set(string, "clantag", clantag);
format(string, sizeof(string), "Clan %s using clantag %s was successfully created", clanname, clantag);
SendClientMessage(playerid, COLOR_GREEN, string);
SendClientMessage(playerid, COLOR_GREEN, "Use /setclanmember [clan name] [player ID] to add a clanmember");
return 1;
}
else return SendClientMessage(playerid,COLOR_RED, "You're not authorized to use that command");
}
if(strcmp(cmd, "/setclan", true) == 0)
new clanname, clantag;
tmp = strtok(cmdtext, idx); /// "cmdtext" should be "cmd"
if(strcmp(cmd, "/setclan", true) == 0)
{
if(AccountInfo[playerid][AdminLevel] >= 4)
{
new clanname, clantag;
tmp = strtok(cmd, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, "USAGE: /setclan [clan name] [tag]");
return 1;
}
clanname = strval(tmp);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /setclan [clan name] [tag]");
tmp = strtok(cmd, idx);
clantag = strval(tmp);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /setclan [clan name] [tag]");
format(string, sizeof(string), "clans/%s.ini", clanname);
if(dini_Exists(string)) return SendClientMessage(playerid,COLOR_RED, "Clan exists already");
if(!dini_Exists(string))
{
dini_Create(string);
}
dini_Set(string, "clantag", clantag);
format(string, sizeof(string), "Clan %s using clantag %s was successfully created", clanname, clantag);
SendClientMessage(playerid, COLOR_GREEN, string);
SendClientMessage(playerid, COLOR_GREEN, "Use /setclanmember [clan name] [player ID] to add a clanmember");
return 1;
}
else return SendClientMessage(playerid,COLOR_RED, "You're not authorized to use that command");
}
if(strcmp(cmdtext, "/setclan", true) == 0)
{
if(AccountInfo[playerid][AdminLevel] >= 4)
{
new clanname, clantag;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, "USAGE: /setclan [clan name] [tag]");
return 1;
}
clanname = strval(tmp);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /setclan [clan name] [tag]");
tmp = strtok(cmdtext, idx);
clantag = strval(tmp);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /setclan [clan name] [tag]");
format(string, sizeof(string), "clans/%s.ini", clanname);
if(dini_Exists(string)) return SendClientMessage(playerid,COLOR_RED, "Clan exists already");
if(!dini_Exists(string))
{
dini_Create(string);
}
dini_Set(string, "clantag", clantag);
format(string, sizeof(string), "Clan %s using clantag %s was successfully created", clanname, clantag);
SendClientMessage(playerid, COLOR_GREEN, string);
SendClientMessage(playerid, COLOR_GREEN, "Use /setclanmember [clan name] [player ID] to add a clanmember");
return 1;
}
else return SendClientMessage(playerid,COLOR_RED, "You're not authorized to use that command");
}
Originally Posted by [B2K
Hustler ]
Shouldn't "cmdtext" should be "cmd" or vice versa? |