példa a frakció mentésére,én így csinálom.mysql-es
format(Query, sizeof(Query), \"SELECT * FROM `Frakcio` WHERE `frakcio` = \'%s\' \", FrakcioNev);
mysql_query(Query);
mysql_store_result();
példa a frakció mentésére,én így csinálom.mysql-es
format(Query, sizeof(Query), \"SELECT * FROM `Frakcio` WHERE `frakcio` = \'%s\' \", FrakcioNev);
mysql_query(Query);
mysql_store_result();
Ez tudtad, hogy kiválaszt a frakció táblából mindent? Nem ment semmit. :D
#include < a_samp >
#include < zcmd >
#include < sscanf2 >
#include < dini >
new
szFile[ 40 + 1 ];
public OnPlayerConnect( playerid )
{
format( szFile, sizeof( szFile ), \"Fractions/%s.ini\", szName( playerid ) );
if( dini_Exists( szFile ) )
{
SetPVarInt( playerid, \"iRank\", dini_Int( szFile, \"Rank\" ) );
}
else
{
SetPVarInt( playerid, \"iRank\", 0 );
dini_Create( szFile );
}
return 1;
}
public OnPlayerDisconnect( playerid, reason )
{
format( szFile, sizeof( szFile ), \"Fractions/%s.ini\", szName( playerid ) );
dini_IntSet( szFile, \"Rank\", GetPVarInt( playerid, \"iRank\" ) );
return 1;
}
CMD:setrank( playerid, params[] )
{
if( GetPVarInt( playerid, \"iRank\" ) == 3 || IsPlayerAdmin( playerid ) )
{
new
iPlayer,
iRank;
if( sscanf( params, \"ui\", iPlayer, iRank ) ) return SendClientMessage( playerid, 0xFF0000AA, \"Használat: /setrank <Játékos ID/Név> <Szint>\" );
if( iPlayer == INVALID_PLAYER_ID ) return SendClientMessage( playerid, 0xFF0000AA, \"HIBA: Érvénytelen ID/Név.\" );
if( ( 0 < iRank > 3 ) ) return SendClientMessage( playerid, 0xFF0000AA, \"HIBA: A szint csak 0-3 között lehet.\" );
SetPVarInt( iPlayer, \"iRank\", iRank );
}
return 1;
}
stock szName( playerid )
{
static
s_szName[ MAX_PLAYER_NAME + 1 ];
GetPlayerName( playerid, s_szName, MAX_PLAYER_NAME );
return s_szName;
}
#include < a_samp >
new
iPickup;
public OnFilterScriptInit( )
{
iPickup = CreatePickup( 1540, 2, 0.1, 1.0, 2.0, -1 );
return 1;
}
public OnPlayerPickUpPickup( playerid, pickupid )
{
if( pickupid == iPickup )
{
SetPVarInt( playerid, \"iRank\", 1 );
}
return 1;
}