help me! - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: help me! (
/showthread.php?tid=389557)
help me! -
organe. - 02.11.2012
Hey all, i create a new system and have problem.
Код:
new LOAN[ 1 ][ MAX_PLAYERS ];
/*
LOAN[ 0 ] have loan
LOAN[ 1 ] pay loan
*/
forward checkLOAN( playerid );
public checkLOAN( playerid )
{
if( LOAN[ 0 ][ playerid ] < 0 )
{
new String[ 100 ];
format( String, 100, "* YOU HAVE LOAN: %d, and you have to pay he loan: %d", LOAN[ 0 ][ playerid ], LOAN[ 1 ] [ playerid ] + payyLOAN( playerid ) );
SendClientMessage( playerid, -1, String );
}
return 1;
}
stock payyLOAN( playerid )
{
if( LOAN[ 0 ][ playerid ] < 100 )
{
LOAN[ 1 ][ playerid ] += 10;
} else if( LOAN[ 0 ][ playerid ] < 1000 )
{
LOAN[ 1 ][ playerid ] += 100;
}
}
And have error's
Код:
C:\Documents and Settings\User\Desktop\oADMIN.pwn(27) : error 032: array index out of bounds (variable "LOAN")
C:\Documents and Settings\User\Desktop\LOAN.pwn(37) : error 032: array index out of bounds (variable "LOAN")
C:\Documents and Settings\User\Desktop\LOAN.pwn(40) : error 032: array index out of bounds (variable "LOAN")
C:\Documents and Settings\User\Desktop\LOAN.pwn(42) : warning 209: function "payyLOAN" should return a value
Thanks : ))
Re: help me! -
InfiniTy. - 02.11.2012
Change new LOAN[1][MAX_PLAYERS];
to LOAN[MAX_PLAYERS][1];
And before the last } at stock payloan put return 1;
Or if you are lazy here's the fixed code
pawn Код:
new LOAN[MAX_PLAYERS][1];
/*
LOAN[ 0 ] have loan
LOAN[ 1 ] pay loan
*/
forward checkLOAN( playerid );
public checkLOAN( playerid )
{
if( LOAN[ 0 ][ playerid ] < 0 )
{
new String[ 100 ];
format( String, 100, "* YOU HAVE LOAN: %d, and you have to pay he loan: %d", LOAN[ 0 ][ playerid ], LOAN[ 1 ] [ playerid ] + payyLOAN( playerid ) );
SendClientMessage( playerid, -1, String );
}
return 1;
}
stock payyLOAN( playerid )
{
if( LOAN[ 0 ][ playerid ] < 100 )
{
LOAN[ 1 ][ playerid ] += 10;
} else if( LOAN[ 0 ][ playerid ] < 1000 )
{
LOAN[ 1 ][ playerid ] += 100;
}
return 1;
}
Re: help me! -
organe. - 02.11.2012
very thanks : ))