21.02.2011, 21:07
I (hopefully) have fixed your code.
pawn Код:
COMMAND:createclan(playerid, params[])
{
new tag[32], type, sendername[MAX_PLAYER_NAME], string[128], result[128];
if(KeyInfo[playerid][pRank] > 0) return SendClientMessage(playerid,Red,"You are already in a clan !");
if (sscanf(params, "is[32]", type, tag)) return SendClientMessage(playerid, Yellow, "Usage: /createclan [1 (start) / 2 (end)] [tag], Do not include [ or ] in the tag");
new Clann = KeyInfo[playerid][pClan];
for(new i = 0; i < sizeof(Clans); i++) {
if(Clann != 255) {
SendClientMessage(playerid,Red,"You are in a clan !");
return 1;
}
if(strmatch(Clans[i][cName],result)) return SendClientMessage(playerid,Red,"Clan name already exists !");
switch (type) {
case 1:
{
i = lastclan;
KeyInfo[playerid][pClan] = lastclan;
KeyInfo[playerid][pRank] = 3;
GetPlayerName(playerid,sendername,sizeof(sendername));
strmid(Clans[i][clOwner], sendername, 0, strlen(sendername), 255);
strmid(Clans[i][cName], result, 0, strlen(result), 255);
Clans[i][Front] = 1;
format(string,sizeof(string),"You have created the clan [%s], at the front of your name.",result);
SendClientMessage(playerid,Green,string);
lastclan++;
SaveClans();
OnPlayerDataSave(playerid);
return 1;
}
case 2:
{
i = lastclan;
KeyInfo[playerid][pClan] = lastclan;
KeyInfo[playerid][pRank] = 3;
GetPlayerName(playerid,sendername,sizeof(sendername));
strmid(Clans[i][clOwner], sendername, 0, strlen(sendername), 255);
strmid(Clans[i][cName], result, 0, strlen(result), 255);
Clans[i][Back] = 1;
format(string,sizeof(string),"You have created the clan [%s], at the back of your name.",result);
SendClientMessage(playerid,Green,string);
lastclan++;
SaveClans();
OnPlayerDataSave(playerid);
return 1;
}
default:
{
SendClientMessage(playerid, Green, "Test");
}
}
}
return 1;
}