23.07.2010, 07:22
okay ingame it does not work and i do not get any errors just a single waring when i compile the gm.
here is my code tell me if you see something wrong.
here is my code tell me if you see something wrong.
pawn Код:
if(strcmpEx(cmd, "/radio", true) == 0 || strcmpEx(cmd, "/r", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new wstring[128];
new faction = pStats[playerid][pFaction];
new rank = pStats[playerid][pRank];
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[128];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_WHITE, "SYNTAX - (/r)adio");
return 1;
}
if(Muted[playerid])
{
SendClientMessage(playerid, COLOR_RED, "You can't use the radio, You're muted.");
return 1;
}
if(pStats[playerid][pFaction] != 255 && DynamicFactions[pStats[playerid][pFaction]][fType] == 1)// || pStats[playerid][pFaction] != 255 && DynamicFactions[pStats[playerid][pFaction]][fType] == 2)
{
if(pStats[playerid][pCopDuty] == 1)
{
if(rank == 1)
{
format(wstring, sizeof(wstring), "[RADIO] %s %s: %s, over.",DynamicFactions[faction][fRank1],GetPlayerNameEx(playerid),result);
SendFactionMessage(pStats[playerid][pFaction], COLOR_LSPD, wstring);
FactionChatLog(wstring);
}
else if(rank == 2)
{
format(wstring, sizeof(wstring), "[RADIO] %s %s: %s, over.",DynamicFactions[faction][fRank2],GetPlayerNameEx(playerid),result);
SendFactionMessage(pStats[playerid][pFaction], COLOR_LSPD, wstring);
FactionChatLog(wstring);
}
else if(rank == 3)
{
format(wstring, sizeof(wstring), "[RADIO] %s %s: %s, over.",DynamicFactions[faction][fRank3],GetPlayerNameEx(playerid),result);
SendFactionMessage(pStats[playerid][pFaction], COLOR_LSPD, wstring);
FactionChatLog(wstring);
}
else if(rank == 4)
{
format(wstring, sizeof(wstring), "[RADIO] %s %s: %s, over.",DynamicFactions[faction][fRank4],GetPlayerNameEx(playerid),result);
SendFactionMessage(pStats[playerid][pFaction], COLOR_LSPD, wstring);
FactionChatLog(wstring);
}
else if(rank == 5)
{
format(wstring, sizeof(wstring), "[RADIO] %s %s: %s, over.",DynamicFactions[faction][fRank5],GetPlayerNameEx(playerid),result);
SendFactionMessage(pStats[playerid][pFaction], COLOR_LSPD, wstring);
FactionChatLog(wstring);
}
else if(rank == 6)
{
format(wstring, sizeof(wstring), "[RADIO] %s %s: %s, over.",DynamicFactions[faction][fRank6],GetPlayerNameEx(playerid),result);
SendFactionMessage(pStats[playerid][pFaction], COLOR_LSPD, wstring);
FactionChatLog(wstring);
}
else if(rank == 7)
{
format(wstring, sizeof(wstring), "[RADIO] %s %s: %s, over.",DynamicFactions[faction][fRank7],GetPlayerNameEx(playerid),result);
SendFactionMessage(pStats[playerid][pFaction], COLOR_LSPD, wstring);
FactionChatLog(wstring);
}
else if(rank == 8)
{
format(wstring, sizeof(wstring), "[RADIO] %s %s: %s, over.",DynamicFactions[faction][fRank8],GetPlayerNameEx(playerid),result);
SendFactionMessage(pStats[playerid][pFaction], COLOR_LSPD, wstring);
FactionChatLog(wstring);
}
else if(rank == 9)
{
format(wstring, sizeof(wstring), "[RADIO] %s %s: %s, over.",DynamicFactions[faction][fRank9],GetPlayerNameEx(playerid),result);
SendFactionMessage(pStats[playerid][pFaction], COLOR_LSPD, wstring);
FactionChatLog(wstring);
}
else if(rank == 10)
{
format(wstring, sizeof(wstring), "[RADIO] %s %s: %s, over.",DynamicFactions[faction][fRank10],GetPlayerNameEx(playerid),result);
SendFactionMessage(pStats[playerid][pFaction], COLOR_LSPD, wstring);
FactionChatLog(wstring);
}
}
else
{
SendClientMessage(playerid,COLOR_WHITE, "You're not on duty!");
}
}
else
{
SendClientMessage(playerid,COLOR_WHITE, "You are not a member of the required faction/type.");
}
}
return 1;
}
if(strcmpEx(cmd, "/faction", true) == 0 || strcmpEx(cmd, "/f", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new wstring[128];
new faction = pStats[playerid][pFaction];
new rank = pStats[playerid][pRank];
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[128];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_WHITE, "SYNTAX - (/f)action [message]");
return 1;
}
if(Muted[playerid])
{
SendClientMessage(playerid, COLOR_RED, "You can't use faction chat, You're muted.");
return 1;
}
if(pStats[playerid][pFaction] != 255)
{
if(rank == 1)
{
format(wstring, sizeof(wstring), "(( [F-OOC:] %s %s: %s ))",DynamicFactions[faction][fRank1],GetPlayerNameEx(playerid),result);
SendFactionMessage(pStats[playerid][pFaction], COLOR_FACTIONCHAT, wstring);
FactionChatLog(wstring);
}
else if(rank == 2)
{
format(wstring, sizeof(wstring), "(( [F-OOC:] %s %s: %s ))",DynamicFactions[faction][fRank2],GetPlayerNameEx(playerid),result);
SendFactionMessage(pStats[playerid][pFaction], COLOR_FACTIONCHAT, wstring);
FactionChatLog(wstring);
}
else if(rank == 3)
{
format(wstring, sizeof(wstring), "(( [F-OOC:] %s %s: %s ))",DynamicFactions[faction][fRank3],GetPlayerNameEx(playerid),result);
SendFactionMessage(pStats[playerid][pFaction], COLOR_FACTIONCHAT, wstring);
FactionChatLog(wstring);
}
else if(rank == 4)
{
format(wstring, sizeof(wstring), "(( [F-OOC:] %s %s: %s ))",DynamicFactions[faction][fRank4],GetPlayerNameEx(playerid),result);
SendFactionMessage(pStats[playerid][pFaction], COLOR_FACTIONCHAT, wstring);
FactionChatLog(wstring);
}
else if(rank == 5)
{
format(wstring, sizeof(wstring), "(( [F-OOC:] %s %s: %s ))",DynamicFactions[faction][fRank5],GetPlayerNameEx(playerid),result);
SendFactionMessage(pStats[playerid][pFaction], COLOR_FACTIONCHAT, wstring);
FactionChatLog(wstring);
}
else if(rank == 6)
{
format(wstring, sizeof(wstring), "(( [F-OOC:] %s %s: %s ))",DynamicFactions[faction][fRank6],GetPlayerNameEx(playerid),result);
SendFactionMessage(pStats[playerid][pFaction], COLOR_FACTIONCHAT, wstring);
FactionChatLog(wstring);
}
else if(rank == 7)
{
format(wstring, sizeof(wstring), "(( [F-OOC:] %s %s: %s ))",DynamicFactions[faction][fRank7],GetPlayerNameEx(playerid),result);
SendFactionMessage(pStats[playerid][pFaction], COLOR_FACTIONCHAT, wstring);
FactionChatLog(wstring);
}
else if(rank == 8)
{
format(wstring, sizeof(wstring), "(( [F-OOC:] %s %s: %s ))",DynamicFactions[faction][fRank8],GetPlayerNameEx(playerid),result);
SendFactionMessage(pStats[playerid][pFaction], COLOR_FACTIONCHAT, wstring);
FactionChatLog(wstring);
}
else if(rank == 9)
{
format(wstring, sizeof(wstring), "(( [F-OOC:] %s %s: %s ))",DynamicFactions[faction][fRank9],GetPlayerNameEx(playerid),result);
SendFactionMessage(pStats[playerid][pFaction], COLOR_FACTIONCHAT, wstring);
FactionChatLog(wstring);
}
else if(rank == 10)
{
format(wstring, sizeof(wstring), "(( [F-OOC:] %s %s: %s ))",DynamicFactions[faction][fRank10],GetPlayerNameEx(playerid),result);
SendFactionMessage(pStats[playerid][pFaction], COLOR_FACTIONCHAT, wstring);
FactionChatLog(wstring);
}
}
else
{
SendClientMessage(playerid,COLOR_WHITE, "You are not a member of a faction!");
}
}
return 1;
}