Quote:
Originally Posted by the_chaoz
intenta asi:
pawn Код:
dcmd_recompensas (playerid, params[]) { #pragma unused params new stingEX[X], count; for(new i; i<GetMaxPlayers(); i++){ if(IsPlayerConnected(i) && Cantidad[i]){ count++; format(stringEX, sizeof(stringEX), "- %s - Total [$%i]\n", pNombre(i), Cantidad[i]); SendClientMessage(playerid,-1,stingEX); } } if(!count)return SendClientMessage(playerid, -1, "No hay recompenzas"); return 1; }
EDIT:
Si, las variables se inicializan por defecto con el valor 0.
|
Me tira 4 errores
Код:
C:\Documents and Settings\Godoy\Mis documentos\GTA San Andreas User Files\SAMP\Server 6\gamemodes\server.pwn(594) : error 017: undefined symbol "X"
C:\Documents and Settings\Godoy\Mis documentos\GTA San Andreas User Files\SAMP\Server 6\gamemodes\server.pwn(594) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Godoy\Mis documentos\GTA San Andreas User Files\SAMP\Server 6\gamemodes\server.pwn(594) : error 017: undefined symbol "count"
C:\Documents and Settings\Godoy\Mis documentos\GTA San Andreas User Files\SAMP\Server 6\gamemodes\server.pwn(594) : fatal error 107: too many error messages on one line
Quote:
Originally Posted by DreamOnIt
pawn Код:
else { SendClientMessage(playerid, -1, "No hay Recompensas."); }
Entonces para que queres esto si no queres que se mande no? :/
pd: en pawn las variables se inicializan implicitamente a cero? pregunto, porque si no es asi, inicializala, porque acumula valores basura y te puede llegar a dar cualquier cosa
Saludos
|
Para que haga una funciуn y no se quede en blanco.
Quote:
Originally Posted by dis77urbio
pawn Код:
dcmd_recompensas( playerid, params[ ] ) { #pragma unused params
new bString[ MAX_CLIENT_MSG ], pName[ MAX_PLAYER_NAME ], counter; bString = "* ";
SendClientMessage( playerid, COLOR_GREEN, "Recompensas:" );
for(new i=0; i < MAX_PLAYERS; i++) { if ( pData[ i ][ P_BOUNTY ] ) //AQUI PON TU VARIABLE DE LAS RECOMPENSAS { GetPlayerName( i, pName, MAX_PLAYER_NAME );
if ( counter > 2 ) { SendClientMessage( playerid, COLOR_YELLOW, bString ); bString = "* "; format( bString, sizeof( bString ), "%s%s(%d)($%d), ", bString, pName, i,pData[ i ][ P_BOUNTY ] );//PON TU VARIABLE DE LAS RECOMPENSAS counter = 1; }
else { format( bString, sizeof( bString ), "%s%s(%d)($%d), ", bString, pName, i, pData[ i ][ P_BOUNTY ] );// PON TU VARIABLE DE LAS RECOMPENSAS counter++; } } }
if ( strlen( bString[ 2 ] ) ) SendClientMessage( playerid, COLOR_YELLOW, bString );
return 1; }
|
Tambiйn me tira 4 errores
(Parecidos a los de arriba)