12.07.2018, 09:06
Код:
CMD:setmoney ( playerid , params [] )
{
if ( !PlayerInfo[playerid][pAdmin] >= 4 ) return SendClientMessage (playerid , COLOR_CORRECTION , "You are not admin!" ) ;
new id , ammount;
if ( !IsPlayerConnected ( id ) ) return SendClientMessage ( playerid , COLOR_CORRECTION , "Invalid player specified !" ) ;
if ( ammount < 0 || ammount > 900000000 ) return SendClientMessage ( playerid , -1 , "You can't set more than $900.000.000" ) ;
if ( GetPlayerMoney ( playerid ) < ammount ) return SendClientMessage ( playerid , -1 , "You cant give money more than you have." ) ;
if ( sscanf ( params , "ui" , id , ammount ) ) return SendClientMessage ( playerid , -1 , "USAGE : /setmoney [PlayerID / PartOfName] [Ammount]" ) ;
else
{
new IName [ MAX_PLAYER_NAME ] , PName [ MAX_PLAYER_NAME ] , Str [ 128 ] ;
GetPlayerName ( id , IName , MAX_PLAYER_NAME ) ;
GetPlayerName ( playerid , IName , MAX_PLAYER_NAME ) ;
format ( Str , 128 , "%s Has Given You %d" , IName , ammount ) ;
SendClientMessage ( id , COLOR_RED , Str ) ;
format ( Str , 128 , "You Gave %d Money To %s" , ammount , PName ) ;
SendClientMessage ( playerid , COLOR_GREEN , Str ) ;
GivePlayerMoney ( id , ammount ) ;
}
return 1;
}

