19.06.2010, 11:19
Okay so i'm attempting to make an accent system for an gamemode i'm working on, But the problem is that pawno crashes if i try to compile it..
pawn Код:
if(strcmp(cmd, "/Accent", true) == 0 || strcmp(cmd, "/acce", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GREY, "[HINT] You need to login first ! ");
return 1;
}
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(length > 64)
{
SendClientMessage(playerid, COLOR_GREY, " Accent is too long ! ");
return 1;
}
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "[USAGE] /Accent [text]");
return 1;
}
if(PlayerInfo[playerid][pAccent] == 0)
{
strmid(PlayerInfo[playerid][pAccent], result, 0, strlen(result), 255);
PlayerInfo[playerid][pAccent] = 1;
SendClientMessage(playerid, COLOR_WHITE, "[INFO] You have successfuly Set your Accent.");
return 1;
}
else if(PlayerInfo[playerid][pAccent] == 1)
{
PlayerInfo[playerid][pAccent] = 0;
SendClientMessage(playerid, COLOR_WHITE, "[INFO] You have successfuly removed your Accent.");
}
}
}