19.04.2011, 07:37
hey guys.. i had a little problem making reason for giving cookies for my cookie system using sscanf made by ******. Anyone who would explain this i may thank him for helping .
pawn Код:
CMD:givecookies ( playerid , params [ ] ) {
if ( Account [ playerid ] [ Cookies ] < 1 )
return SendClientMessage ( playerid , -1 , ""#RED"ERROR: "#YELLOW"You don't have enough "#RED"Cookies "#YELLOW" to give to other players" ) ;
if ( sscanf ( params , "ui" , params [ 0 ] , params [ 1 ] ) )
return SendClientMessage ( playerid , -1 , ""#ORANGE"USAGE: "#YELLOW"/givecookies "#RED" [ playerid ] [ amount ] [ reasons ]" ) ;
if ( !IsPlayerConnected ( params [ 0 ] ) )
return SendClientMessage ( playerid , -1 , ""#RED"ERROR: "#YELLOW"No player "#LIGHTBLUE"connected" ) ;
Account [ params [ 0 ] ] [ Cookies ] += params [ 1 ] ;
Account [ playerid ] [ Cookies ] -= params [ 1 ] ;
SaveFileInINI ( playerid ) ;
if ( sscanf ( params [ 2 ] , "s" ) ) {
new
str [ MAX_STRINGS ] ;
format ( str , sizeof ( str ) , ""#PURPLE"%s "#YELLOW" has give you "#RED"%i Cookies. "#LIGHTBLUE"[ "#YELLOW"Reasons: "#RED"%s "#LIGHTBLUE"]" , iName ( playerid ) , params [ 1 ] , params [ 2 ] ) ;
SendClientMessage ( params [ 0 ] , -1 , str ) ;
}
else {
new
str [ MAX_STRINGS ] ;
format ( str , sizeof ( str ) , ""#PURPLE"%s "#YELLOW" has give you "#RED"%i Cookies. "#LIGHTBLUE"[ "#YELLOW"Reasons: "#RED"Not Specified "#LIGHTBLUE"]" , iName ( playerid ) , params [ 1 ] ) ;
SendClientMessage ( params [ 0 ] , -1 , str ) ;
}
return 1 ;
}