09.07.2012, 17:16
(
Последний раз редактировалось kurta999; 09.07.2012 в 20:47.
)
Hi.
I have problem with clearing the string.
Here is my script which I use.
When I type /test, then script generate 9 lenght random world into g_szReactionStr. (g_szReactionStr size is 24 cell)
If I type /ctest ASD123456789oiu, then this will work, but here come the problem.
When ReactionTest() runs (ModifedString = false), then doesn't get cleared the string, only the first 9 character.
So I get random frist 9 character, and the latest will be: xxxxxx456789oiu
I don't understand this, the latest worlds why doesn't get cleared..
This should be: xxxxxx, and not xxxxxx456789oiu
E: Fixed, but this is interesting..
I have problem with clearing the string.
Here is my script which I use.
When I type /test, then script generate 9 lenght random world into g_szReactionStr. (g_szReactionStr size is 24 cell)
If I type /ctest ASD123456789oiu, then this will work, but here come the problem.
When ReactionTest() runs (ModifedString = false), then doesn't get cleared the string, only the first 9 character.
So I get random frist 9 character, and the latest will be: xxxxxx456789oiu
I don't understand this, the latest worlds why doesn't get cleared..
This should be: xxxxxx, and not xxxxxx456789oiu
pawn Код:
CMD:ctest(playerid, params[])
{
if(GetPVarInt(playerid, "Level") < 4 && !IsPlayerAdmin(playerid))
return SendClientMessage(playerid, COLOR_RED, MSG_OWNER);
if(isnull(params)) return SendClientMessage(playerid, COLOR_RED, "HASZNБLAT: /ctest <Szцveg>");
if(strlen(params) >= sizeof(g_szReactionStr)) return SendClientMessage(playerid, COLOR_RED, "Tъl hosszъ a szцveg! Maximum 24 karakter lehet!");
if(params[0] == '/') params[0] = '^';
g_szReactionStr[0] = EOS;
strcat(g_szReactionStr, params, sizeof(g_szReactionStr));
ReactionTest(true);
return 1;
}
forward ReactionTest(bool:ModifedString);
public ReactionTest(bool:ModifedString)
{
if(!Itter_Count(Player)) return 0;
// printf("ReactionTest(ModifedString = %d)", ModifedString);
if(!ModifedString)
{
Ide:
static const
szReactionStr[] = "ABCDEFGHJKLMNOPQRSTUVWXYZ0123456789abcdefghijkmnopqrstuvwxyz";
format(g_szReactionStr, sizeof(g_szReactionStr), ""); // I tried var[0] = EOS and same problem..
for(new i; i < 9; i++)
{
g_szReactionStr[i] = szReactionStr[random(sizeof(szReactionStr))];
}
while(strlen(g_szReactionStr) < 4) goto Ide;
}
g_iReactionActive = 1;
SendClientMessageToAllf(COLOR_PINK, "Aki leghamarabb beнrja ezt: {" #XCOLOR_LIGHTGREEN2 "}%s {" #XCOLOR_PINK "}az nyer {" #XCOLOR_GREEN "}$9000-t & +3 {" #XCOLOR_PINK "}XP-t!", g_szReactionStr);
g_iReactionTime = GetTickCount();
return 1;
}