Invalid Memory Access? -
Youssef221 - 28.06.2015
Weird, I see these errors in my server logs when I try to use /moneybag.
[13:15:35] [debug] Run time error 5: "Invalid memory access"
[13:15:35] [debug] AMX backtrace:
[13:15:35] [debug] #0 0007d0f0 in StringReplace (string[]=@01fa32ec "UZair", replace[]=@01f81abc "UZair", size=24) at D:\SA-MP Things\SAMP 0.3.7\gamemodes\LSGW.pwn:8549
[13:15:35] [debug] #1 0007c568 in public cmd_moneybag (playerid=2, params[]=@021f81d0 "") at D:\SA-MP Things\SAMP 0.3.7\gamemodes\LSGW.pwn:8497
[13:15:35] [debug] #2 native CallLocalFunction () from samp03svr
[13:15:35] [debug] #3 0001d60c in ?? (... <2 arguments>) at D:\SA-MP Things\SAMP 0.3.7\pawno\include\i-zcmd.inc:94
[13:15:35] [debug] #4 0000e8c4 in public OnPlayerCommandText (playerid=2, cmdtext[]=@021f81a8 "/moneybag") at D:\SA-MP Things\SAMP 0.3.7\pawno\include\YSI\y_hooks/impl.inc:929
Moneybag CMD:
pawn Код:
CMD:moneyrush(playerid)
{
if(!IsPlayerSpawned(playerid)) return SendClientMessage(playerid,COLOR_ERROR,"You can not use this command while you are dead.");
new bags = 0, string[50];
for(new i=0; i < MAX_BAGS; i++)
{
if(PlayerMoneyBagInfo[i][pBagDropped])
{
bags++;
if(bags < 16 && bags > 0)
{
ShowTextDrawMenu(playerid, TD_MENU_INFO,"~G~Money Bags", bags+3, 0);
ShowTextDrawMenuItems(playerid, 0, "Money Bags Dropped By Players", " ", " ");
format(string,sizeof(string),"~P~%s ~W~by %s",PlayerMoneyBagInfo[i][pBagLoc],PlayerMoneyBagInfo[i][pBagDroppedBy]);
ShowTextDrawMenuItems(playerid, bags+2, " ", string, " ");
}
}
}
if(bags == 0)
{
ShowTextDrawMenu(playerid, TD_MENU_INFO,"~G~Money Bags", bags+1, 0);
ShowTextDrawMenuItems(playerid, 0, "Money Bags Dropped By Players", " ", " ");
ShowTextDrawMenuItems(playerid, bags+1, " ", "~R~ No ~W~Players ~G~Money Bag~R~ Lost ", " ");
}
return 1;
}
forward SaveMoneyBagPickup(bagid); // Line 8497
public SaveMoneyBagPickup(bagid)
{
PlayerMoneyBagInfo[bagid][pBagJustDroped]=false;
return 1;
}
Re: Invalid Memory Access? -
Jefff - 28.06.2015
Show function 'StringReplace' and line 8549
size don't match
example with OnPlayerText:
public OnPlayerText(playerid, text[])
{
// if 'text' is hello - strlen is 5
print(text[8]); // if you print text[8] its Invalid memory access
}
Re: Invalid Memory Access? -
Youssef221 - 28.06.2015
pawn Код:
stock StringReplace(string[],replace[],const size)
{
strdel(string,0,size);
strins(string,replace,0,size);
return string;
}
Re: Invalid Memory Access? -
Youssef221 - 28.06.2015
anyone?
Re: Invalid Memory Access? -
Jonny5 - 28.06.2015
first off please dont bump before 24 hours, your post will be answered when someone sees it and has an answer for you.
second the function in question is
CMD:moneybag
not
CMD:moneyrush
so post the right command and maybe we can help
Re: Invalid Memory Access? -
Youssef221 - 28.06.2015
nevermind fixed it, thanks.